11.stylix/stylix/overlays.nix
NAHO dfc859f54d
treewide: optionalize mkTarget's humanName and name arguments
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
2025-12-10 14:48:37 +01:00

36 lines
674 B
Nix

{
lib,
pkgs,
config,
options,
...
}:
{
options.stylix.overlays.enable = config.lib.stylix.mkEnableTarget "packages via overlays" true;
imports = map (
f:
let
file = import f;
attrs =
if builtins.isFunction file then
file {
inherit
lib
pkgs
config
options
;
}
else
file;
in
{
_file = f;
options = attrs.options or { };
config.nixpkgs.overlays = lib.mkIf config.stylix.overlays.enable [
attrs.overlay
];
}
) (import ./autoload.nix { inherit lib pkgs; } "overlay");
}