diff options
-rw-r--r-- | lib/call-network.nix | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/lib/call-network.nix b/lib/call-network.nix index 509f34b9..f65b1156 100644 --- a/lib/call-network.nix +++ b/lib/call-network.nix @@ -1,24 +1,18 @@ path: args: let - __withPkgsPath = nixpkgs: let - lib = import "${nixpkgs}/lib"; + machineAttrs = import path; + machineNames = builtins.attrNames machineAttrs; - machineAttrs = import path; + mkMachine = name: { + inherit name; + value = import ./call-machine.nix machineAttrs.${name} ({ lib, ... }: { + imports = lib.singleton (args.extraConfig or {}); + networking.hostName = lib.mkOverride 900 name; + _module.args.nodes = lib.mapAttrs (lib.const (m: m ? eval)) machines; + } // removeAttrs args [ "extraConfig" ]); + }; - mkMachine = name: { - inherit name; - value = (import ./call-machine.nix machineAttrs.${name} ({ lib, ... }: { - imports = lib.singleton (args.extraConfig or {}); - networking.hostName = lib.mkOverride 900 name; - _module.args.nodes = lib.mapAttrs (lib.const (m: m ? eval)) machines; - } // removeAttrs args [ "extraConfig" ])).__withPkgsPath nixpkgs; - }; + machines = builtins.listToAttrs (map mkMachine machineNames); - machines = lib.listToAttrs (map mkMachine (lib.attrNames machineAttrs)); - - in machines; - -in __withPkgsPath (import ../nixpkgs-path.nix) // { - inherit __withPkgsPath; -} +in machines |