diff --git a/flake.nix b/flake.nix index d23d1eb..b0191e3 100644 --- a/flake.nix +++ b/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; }); }