Merge #198
198: hosts/devosSystem: pass modules as attrset r=nrdxp a=Pacman99 This is a fairly simple change that only changes the lib api for devosSystem. But doesn't add any features by itself. Hosts now pass modules to devosSystem as an attrset. And devosSystem just grabs all modules in the set and passes it to nixosSystem. I plan to use this in #197 to selectively import modules. And I think it could help with nix-darwin - and other config systems - support, since not all profiles and modules are config system agnostic. This could be a workaround to add rudimentary support for other config systems by only importing the necessary modules. Overall I think its a useful change and extends the abilities of `devosSystem` Co-authored-by: Pacman99 <pachum99@gmail.com>
This commit is contained in:
commit
1b4edf3333
|
@ -13,8 +13,7 @@ let
|
||||||
|
|
||||||
suites = import ../suites { inherit lib; };
|
suites = import ../suites { inherit lib; };
|
||||||
|
|
||||||
modules =
|
modules = {
|
||||||
let
|
|
||||||
core = ../profiles/core;
|
core = ../profiles/core;
|
||||||
modOverrides = { config, overrideModulesPath, ... }:
|
modOverrides = { config, overrideModulesPath, ... }:
|
||||||
let
|
let
|
||||||
|
@ -52,15 +51,8 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
# Everything in `./modules/list.nix`.
|
# Everything in `./modules/list.nix`.
|
||||||
flakeModules =
|
flakeModules = { imports = builtins.attrValues self.nixosModules ++ extern.modules; };
|
||||||
builtins.attrValues self.nixosModules;
|
};
|
||||||
|
|
||||||
in
|
|
||||||
flakeModules ++ [
|
|
||||||
core
|
|
||||||
global
|
|
||||||
modOverrides
|
|
||||||
] ++ extern.modules;
|
|
||||||
|
|
||||||
specialArgs = extern.specialArgs // { inherit suites; };
|
specialArgs = extern.specialArgs // { inherit suites; };
|
||||||
|
|
||||||
|
@ -79,19 +71,16 @@ let
|
||||||
(removeAttrs hosts [ hostName ]);
|
(removeAttrs hosts [ hostName ]);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
lib = {
|
||||||
|
lib = { inherit specialArgs; };
|
||||||
|
lib.testModule = {
|
||||||
|
imports = builtins.attrValues modules;
|
||||||
|
};
|
||||||
|
};
|
||||||
in
|
in
|
||||||
dev.os.devosSystem {
|
dev.os.devosSystem {
|
||||||
inherit system specialArgs;
|
inherit system specialArgs;
|
||||||
|
modules = modules // { inherit local lib; };
|
||||||
modules = modules ++ [
|
|
||||||
local
|
|
||||||
{
|
|
||||||
lib = { inherit specialArgs; };
|
|
||||||
lib.testModule = {
|
|
||||||
imports = modules;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
hosts = dev.os.recImport
|
hosts = dev.os.recImport
|
||||||
|
|
|
@ -4,12 +4,13 @@
|
||||||
lib.nixosSystem (args // {
|
lib.nixosSystem (args // {
|
||||||
modules =
|
modules =
|
||||||
let
|
let
|
||||||
|
moduleList = builtins.attrValues modules;
|
||||||
modpath = "nixos/modules";
|
modpath = "nixos/modules";
|
||||||
cd = "installer/cd-dvd/installation-cd-minimal-new-kernel.nix";
|
cd = "installer/cd-dvd/installation-cd-minimal-new-kernel.nix";
|
||||||
|
|
||||||
isoConfig = (lib.nixosSystem
|
isoConfig = (lib.nixosSystem
|
||||||
(args // {
|
(args // {
|
||||||
modules = modules ++ [
|
modules = moduleList ++ [
|
||||||
"${nixos}/${modpath}/${cd}"
|
"${nixos}/${modpath}/${cd}"
|
||||||
({ config, ... }: {
|
({ config, ... }: {
|
||||||
isoImage.isoBaseName = "nixos-" + config.networking.hostName;
|
isoImage.isoBaseName = "nixos-" + config.networking.hostName;
|
||||||
|
@ -58,7 +59,7 @@ lib.nixosSystem (args // {
|
||||||
];
|
];
|
||||||
})).config;
|
})).config;
|
||||||
in
|
in
|
||||||
modules ++ [{
|
moduleList ++ [{
|
||||||
system.build = {
|
system.build = {
|
||||||
iso = isoConfig.system.build.isoImage;
|
iso = isoConfig.system.build.isoImage;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue