about summary refs log tree commit diff
path: root/lib/call-network.nix
diff options
context:
space:
mode:
Diffstat (limited to 'lib/call-network.nix')
-rw-r--r--lib/call-network.nix31
1 files changed, 18 insertions, 13 deletions
diff --git a/lib/call-network.nix b/lib/call-network.nix
index 6b621357..509f34b9 100644
--- a/lib/call-network.nix
+++ b/lib/call-network.nix
@@ -1,19 +1,24 @@
 path: args:
 
-with import "${import ../nixpkgs-path.nix}/lib";
-
 let
-  machineAttrs = import path;
+  __withPkgsPath = nixpkgs: let
+    lib = import "${nixpkgs}/lib";
+
+    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" ])).__withPkgsPath nixpkgs;
+    };
 
-  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 = mapAttrs (const (m: m ? eval)) machines;
-    } // removeAttrs args [ "extraConfig" ]);
-  };
+    machines = lib.listToAttrs (map mkMachine (lib.attrNames machineAttrs));
 
-  machines = listToAttrs (map mkMachine (attrNames machineAttrs));
+  in machines;
 
-in machines
+in __withPkgsPath (import ../nixpkgs-path.nix) // {
+  inherit __withPkgsPath;
+}