Prevent unnecessary config values
This commit is contained in:
parent
b1ddb0de48
commit
d034d8d471
1 changed files with 8 additions and 5 deletions
|
@ -5,17 +5,20 @@ let
|
||||||
|
|
||||||
mkUsersOption = programs: osConfig: mkOption {
|
mkUsersOption = programs: osConfig: mkOption {
|
||||||
type = types.attrsOf (types.submodule (
|
type = types.attrsOf (types.submodule (
|
||||||
{ ... }: {
|
{ config, ... }: {
|
||||||
options = {
|
options = {
|
||||||
inherit programs;
|
inherit programs;
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
programs = builtins.mapAttrs
|
programs = lib.attrsets.concatMapAttrs
|
||||||
(
|
(
|
||||||
name: config: {
|
name: program:
|
||||||
enable = mkDefault config.enable;
|
if (builtins.elem name (builtins.attrNames config.programs)) then {
|
||||||
}
|
${name} = {
|
||||||
|
enable = mkDefault program.enable;
|
||||||
|
};
|
||||||
|
} else { }
|
||||||
)
|
)
|
||||||
osConfig.programs;
|
osConfig.programs;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue