Unify the machine configuration centrally
This commit is contained in:
parent
34bdf1ca0b
commit
27150198e0
1 changed files with 12 additions and 10 deletions
22
flake.nix
22
flake.nix
|
@ -35,7 +35,14 @@
|
|||
};
|
||||
};
|
||||
|
||||
machines = builtins.mapAttrs (name: value: defaultMachine // value) machineDefinitions;
|
||||
machines = builtins.mapAttrs (
|
||||
name: machineDefinition:
|
||||
defaultMachine // machineDefinition // {
|
||||
config = { ... }@args:
|
||||
((defaultMachine.config args) // (machineDefinition.config args));
|
||||
})
|
||||
machineDefinitions;
|
||||
|
||||
tryFiles = import ./lib/utils/try-files.nix { inherit lib; };
|
||||
in
|
||||
flake-utils.lib.eachDefaultSystem (
|
||||
|
@ -83,10 +90,9 @@
|
|||
config._module.args = {
|
||||
inherit hostname;
|
||||
|
||||
machineConfig = (defaultMachine.config args) //
|
||||
(config args) // {
|
||||
inherit hostname;
|
||||
};
|
||||
machineConfig = (config args) // {
|
||||
inherit hostname;
|
||||
};
|
||||
};
|
||||
})
|
||||
home-manager.nixosModules.home-manager
|
||||
|
@ -104,10 +110,6 @@
|
|||
lib.attrsets.concatMapAttrs (
|
||||
hostname: machine:
|
||||
let
|
||||
machineConfig = { ... }@args:
|
||||
(defaultMachine.config args) //
|
||||
(machine.config args);
|
||||
|
||||
pkgs = import nixpkgs {
|
||||
inherit (machine) system;
|
||||
};
|
||||
|
@ -136,7 +138,7 @@
|
|||
] ++ (lib.optional (userConfigPath != null) userConfigPath);
|
||||
};
|
||||
})
|
||||
(machineConfig { inherit pkgs; }).users)
|
||||
(machine.config { inherit pkgs; }).users)
|
||||
machines;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue