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