Optionalize mkTarget's 'humanName' and 'name' arguments by inferring
'humanName' from the 'name' attribute in the /modules/<MODULE>/meta.nix
file, and 'name' from the /modules/<NAME>/ directory name.
Inferring the 'humanName' and 'name' arguments ensures consistency and
reduces boilerplate.
The 'humanName' and 'name' arguments are optionalized instead of removed
because complex modules generating target derivations need to
distinguish between them.
Closes: https://github.com/nix-community/stylix/issues/1661
Add the mkTarget function, providing a consistent target interface to minimize boilerplate
and automatically safeguard declarations related to disabled options.
The mkTarget function was first discussed in [1] ("extensive mkTarget
function").
[1]: https://github.com/danth/stylix/discussions/1009
Apparently `../modules` is creating a separate derivation that contains
only that folder, so it's now separate from the flake source. But this
transient derivation isn't mentioned explicitly anywhere in the flake
outputs. It makes it impossible to target those modules in
`disabledModules` directive.
For example, after this change is applied, users can solve issues like
https://github.com/danth/stylix/issues/577 locally, by just adding the
following snippet to their configuration:
disabledModules = [ "${inputs.stylix}/modules/regreet/nixos.nix" ];
Reviewed-by: Daniel Thwaites <danthwaites30@btinternet.com>
Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com>