hosts/devosSystem: pass modules as attrset

This commit is contained in:
Pacman99 2021-03-17 15:41:54 -07:00
parent 8ee334277a
commit dd494facc3
2 changed files with 47 additions and 57 deletions

View file

@ -13,54 +13,46 @@ 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 overrides = import ../overrides;
overrides = import ../overrides; inherit (overrides) modules disabledModules;
inherit (overrides) modules disabledModules; in
in {
{ disabledModules = modules ++ disabledModules;
disabledModules = modules ++ disabledModules; imports = map
imports = map (path: "${overrideModulesPath}/${path}")
(path: "${overrideModulesPath}/${path}") modules;
modules;
};
global = {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
hardware.enableRedistributableFirmware = lib.mkDefault true;
nix.nixPath = [
"nixpkgs=${nixos}"
"nixos-config=${self}/compat/nixos"
"home-manager=${home}"
];
nixpkgs = { inherit pkgs; };
nix.registry = {
devos.flake = self;
nixos.flake = nixos;
override.flake = override;
};
system.configurationRevision = lib.mkIf (self ? rev) self.rev;
}; };
# Everything in `./modules/list.nix`. global = {
flakeModules = home-manager.useGlobalPkgs = true;
builtins.attrValues self.nixosModules; home-manager.useUserPackages = true;
in hardware.enableRedistributableFirmware = lib.mkDefault true;
flakeModules ++ [
core nix.nixPath = [
global "nixpkgs=${nixos}"
modOverrides "nixos-config=${self}/compat/nixos"
] ++ extern.modules; "home-manager=${home}"
];
nixpkgs = { inherit pkgs; };
nix.registry = {
devos.flake = self;
nixos.flake = nixos;
override.flake = override;
};
system.configurationRevision = lib.mkIf (self ? rev) self.rev;
};
# Everything in `./modules/list.nix`.
flakeModules = { imports = builtins.attrValues self.nixosModules ++ 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

View file

@ -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;
}; };