hercules-ci / flake-parts

❄️ Simplify Nix Flakes with the module system
https://flake.parts
MIT License
699 stars 38 forks source link

Set `_file` and `_class` for modules defined under `flake.modules.${className}.${moduleName}` #198

Open Atry opened 8 months ago

Atry commented 8 months ago

In https://github.com/NixOS/nixpkgs/pull/197547

I do not expect users or module authors to set the class attribute in their modules (although they may). Instead I envision a library like flake-parts to set this for us.

Since https://github.com/NixOS/nixpkgs/pull/197547 is merged, do we want to introduce a module to set _file and _class for modules defined flake.modules.${className}.${moduleName}?

roberth commented 8 months ago

Yes, that's the plan.

Just haven't executed on it yet. For a modules output, that should probably be in a separately imported module until nix flake check ignores that attribute. We're trying to move it away from such hardcoded logic in Nix, so it's highly unlikely that it will be checked within the current architecture, and that's ok. Maybe the default flake schema could do it, although I have some issues with that feature's design as currently implemented in a PR.