Evaluate machine configs using callPackage
This commit is contained in:
parent
875d82cce8
commit
89daa0c9ba
1 changed files with 7 additions and 5 deletions
12
flake.nix
12
flake.nix
|
@ -38,8 +38,8 @@
|
||||||
machines = builtins.mapAttrs (
|
machines = builtins.mapAttrs (
|
||||||
name: machineDefinition:
|
name: machineDefinition:
|
||||||
defaultMachine // machineDefinition // {
|
defaultMachine // machineDefinition // {
|
||||||
config = { ... }@args:
|
config = { callPackage, ... }:
|
||||||
((defaultMachine.config args) // (machineDefinition.config args));
|
((callPackage defaultMachine.config { }) // (callPackage machineDefinition.config { }));
|
||||||
})
|
})
|
||||||
machineDefinitions;
|
machineDefinitions;
|
||||||
|
|
||||||
|
@ -86,11 +86,11 @@
|
||||||
|
|
||||||
modules = [
|
modules = [
|
||||||
(
|
(
|
||||||
{ pkgs, ... }@args: {
|
{ pkgs, ... }: {
|
||||||
config._module.args = {
|
config._module.args = {
|
||||||
inherit hostname;
|
inherit hostname;
|
||||||
|
|
||||||
machineConfig = (config args) // {
|
machineConfig = (pkgs.callPackage config { }) // {
|
||||||
inherit hostname;
|
inherit hostname;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -113,6 +113,8 @@
|
||||||
pkgs = import nixpkgs {
|
pkgs = import nixpkgs {
|
||||||
inherit (machine) system;
|
inherit (machine) system;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
machineConfig = pkgs.callPackage machine.config { };
|
||||||
in
|
in
|
||||||
lib.attrsets.concatMapAttrs (
|
lib.attrsets.concatMapAttrs (
|
||||||
username: user: {
|
username: user: {
|
||||||
|
@ -137,7 +139,7 @@
|
||||||
] ++ (lib.optional (userConfigPath != null) userConfigPath);
|
] ++ (lib.optional (userConfigPath != null) userConfigPath);
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
(machine.config { inherit pkgs; }).users)
|
machineConfig.users)
|
||||||
machines;
|
machines;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue