evalArgs: cleanup module and type references

fix pathTo and coercedList types
add modulesModule to also include modules option under home
This commit is contained in:
Pacman99 2021-04-23 17:59:01 -07:00
parent 3322bf5fe6
commit fe9ba26561

View file

@ -33,7 +33,7 @@ let
# Apply maybeImport during merge and before check # Apply maybeImport during merge and before check
# To simplify apply keys and improve type checking # To simplify apply keys and improve type checking
pathTo = elemType: coercedTo path maybeImort elemType; pathTo = elemType: with types; coercedTo path maybeImport elemType;
# Accepts single item or a list # Accepts single item or a list
# apply keys end up with a list # apply keys end up with a list
@ -98,13 +98,7 @@ let
Channel this host should follow Channel this host should follow
''; '';
}; };
modules = mkOption {
type = pathToListOf moduleType;
default = [ ];
description = ''
The configuration for this host
'';
};
}; };
}; };
@ -122,13 +116,25 @@ let
}; };
}; };
modulesModule = {
options = {
modules = mkOption {
type = pathToListOf moduleType;
default = [ ];
description = ''
modules to include
'';
};
};
};
# Home-manager's configs get exported automatically from nixos.hosts # Home-manager's configs get exported automatically from nixos.hosts
# So there is no need for a host options in the home namespace # So there is no need for a host options in the home namespace
# This is only needed for nixos # This is only needed for nixos
includeHostsModule = { name, ... }: { includeHostsModule = { name, ... }: {
options = with types; { options = with types; {
hostDefaults = mkOption { hostDefaults = mkOption {
type = submodule [ hostModule externalModulesModule ]; type = submodule [ hostModule externalModulesModule modulesModule ];
default = { }; default = { };
description = '' description = ''
Defaults for all hosts. Defaults for all hosts.
@ -138,7 +144,7 @@ let
''; '';
}; };
hosts = mkOption { hosts = mkOption {
type = attrsOf (submodule hostModule); type = attrsOf (submodule [ hostModule modulesModule ]);
default = { }; default = { };
description = '' description = ''
configurations to include in the ${name}Configurations output configurations to include in the ${name}Configurations output
@ -205,14 +211,14 @@ let
''; '';
}; };
os = mkOption { os = mkOption {
type = submodule [ includeHostsModule importsModule ]; type = submodule [ includeHostsModule profilesModule ];
default = { }; default = { };
description = '' description = ''
hosts, modules, suites, and profiles for nixos hosts, modules, suites, and profiles for nixos
''; '';
}; };
home = mkOption { home = mkOption {
type = submodule importsModule; type = submodule [ profilesModule modulesModule ];
default = { }; default = { };
description = '' description = ''
hosts, modules, suites, and profiles for home-manager hosts, modules, suites, and profiles for home-manager