From 49dc58c6f8d72a4e142176f25da52666ef9ae268 Mon Sep 17 00:00:00 2001 From: aszlig Date: Tue, 3 May 2016 02:38:45 +0200 Subject: lib/call-machine: Get rid of extraConfig attribute Right now we're not using the system attribute at all and we can still use nixpkgs.system to set the attribute for a particular machine. So we now can pass configuration attributes to the second argument of callMachine *directly* instead of using specific subattributes, which I think feels is a more natural way so users don't need to look up that "extraConfig" is for adding configuration values. Signed-off-by: aszlig --- lib/call-machine.nix | 13 +++---------- lib/call-network.nix | 10 ++++------ 2 files changed, 7 insertions(+), 16 deletions(-) (limited to 'lib') diff --git a/lib/call-machine.nix b/lib/call-machine.nix index d5b8239a..5ab0ba0f 100644 --- a/lib/call-machine.nix +++ b/lib/call-machine.nix @@ -1,15 +1,10 @@ -path: - -{ system ? builtins.currentSystem -, extraConfig ? {} -}: +path: cfg: let nixpkgs = import ../nixpkgs-path.nix; eval = import "${nixpkgs}/nixos/lib/eval-config.nix" { - inherit system; - modules = [ path extraConfig ] ++ import ../modules/module-list.nix; + modules = [ path cfg ] ++ import ../modules/module-list.nix; }; iso = mkIso "${nixpkgs}/nixos/modules/installer/cd-dvd/iso-image.nix" ( @@ -54,16 +49,14 @@ let }; }; in import "${nixpkgs}/nixos/lib/eval-config.nix" { - inherit system; modules = [ config wrapIso ]; }; config = { - imports = [ path extraConfig ] ++ import ../modules/module-list.nix; + imports = [ path cfg ] ++ import ../modules/module-list.nix; }; vm = (import "${nixpkgs}/nixos" { - inherit system; configuration = config; }).vm; diff --git a/lib/call-network.nix b/lib/call-network.nix index d9e073f1..6b621357 100644 --- a/lib/call-network.nix +++ b/lib/call-network.nix @@ -7,12 +7,10 @@ let mkMachine = name: { inherit name; - value = import ./call-machine.nix machineAttrs.${name} ({ - extraConfig = { lib, ... }: { - imports = lib.singleton (args.extraConfig or {}); - networking.hostName = lib.mkOverride 900 name; - _module.args.nodes = mapAttrs (const (m: m ? eval)) machines; - }; + 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" ]); }; -- cgit 1.4.1