From 2cde2ae48b0e8c4cc2d73b4fd2e40c1a8a7006ad Mon Sep 17 00:00:00 2001 From: aszlig Date: Tue, 3 Apr 2018 03:39:59 +0200 Subject: lib/call-network: Only use primops After looking at that expression again, it turns out that we actually don't even need to use __withPkgsPath, because all of the functionality in there can be done using primops only. Signed-off-by: aszlig --- lib/call-network.nix | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) (limited to 'lib/call-network.nix') 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 -- cgit 1.4.1