ref: config -> hosts | nixos -> os

in devos, we differentiate clearly between home and os
configuration, reason for which we are more precise by not naming
after the (more generic) fup API.
This commit is contained in:
David Arnold 2021-04-21 21:44:08 -05:00
parent 8fdd66859c
commit eea4e40d7e
No known key found for this signature in database
GPG key ID: 6D6A936E69C59D08

View file

@ -82,63 +82,63 @@ let
}; };
}; };
configModule = { hostModule = {
options = with types; { options = with types; {
system = mkOption { system = mkOption {
type = systemType; type = systemType;
default = "x86_64-linux"; default = "x86_64-linux";
description = '' description = ''
system for this config system for this host
''; '';
}; };
channelName = mkOption { channelName = mkOption {
type = types.enum (builtins.attrValues config.channels); type = types.enum (builtins.attrValues config.channels);
default = "nixpkgs"; default = "nixpkgs";
description = '' description = ''
Channel this config should follow Channel this host should follow
''; '';
}; };
modules = mkOption { modules = mkOption {
type = pathToListOf moduleType; type = pathToListOf moduleType;
default = [ ]; default = [ ];
description = '' description = ''
The configuration for this config The configuration for this host
''; '';
}; };
}; };
}; };
# This is only needed for configDefaults # This is only needed for hostDefaults
# modules in each config don't get exported # modules in each host don't get exported
externalModulesModule = { externalModulesModule = {
options = { options = {
externalModules = mkOption { externalModules = mkOption {
type = pathToListOf moduleType; type = pathToListOf moduleType;
default = [ ]; default = [ ];
description = '' description = ''
The configuration for this config The configuration for this host
''; '';
}; };
}; };
}; };
# 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 config 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
includeConfigsModule = { name, ... }: { includeHostsModule = { name, ... }: {
options = with types; { options = with types; {
configDefaults = mkOption { hostDefaults = mkOption {
type = submodule [ configModule externalModulesModule ]; type = submodule [ hostModule externalModulesModule ];
default = { }; default = { };
description = '' description = ''
Defaults for all configs. Defaults for all hosts.
the modules passed under configDefault will be exported the modules passed under hostDefaults will be exported
to the '${name}Modules' flake output. to the '${name}Modules' flake output.
They will also be added to all configs. They will also be added to all hosts.
''; '';
}; };
configs = mkOption { hosts = mkOption {
type = attrsOf (submodule configModule); type = attrsOf (submodule hostModule);
default = { }; default = { };
description = '' description = ''
configurations to include in the ${name}Configurations output configurations to include in the ${name}Configurations output
@ -204,8 +204,8 @@ let
nixpkgs channels to create nixpkgs channels to create
''; '';
}; };
nixos = mkOption { os = mkOption {
type = submodule [ includeConfigsModule importsModule ]; type = submodule [ includeHostsModule importsModule ];
default = { }; default = { };
description = '' description = ''
hosts, modules, suites, and profiles for nixos hosts, modules, suites, and profiles for nixos