From 23a12bf4ba8cd9ac145a548cd8eb58a39b5abad8 Mon Sep 17 00:00:00 2001 From: aszlig Date: Tue, 3 May 2016 00:47:45 +0200 Subject: lib/call-machine: Allow to pass extra config So far callMachine only accepted the system attribute as its sole argument, but especially if there are more machines with common attributes, it makes sense to actually call the machines with option definitions that are for example enabling a specific profile module. For example: let commonAttrs.extraConfig = { common.profile.enable = true; }; in { foo = callMachine ./foo commonAttrs; bar = callMachine ./bar commonAttrs; } Signed-off-by: aszlig --- lib/call-machine.nix | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/call-machine.nix b/lib/call-machine.nix index 79829995..16abb9d2 100644 --- a/lib/call-machine.nix +++ b/lib/call-machine.nix @@ -1,11 +1,15 @@ -path: { system ? builtins.currentSystem }: +path: + +{ system ? builtins.currentSystem +, extraConfig ? {} +}: let nixpkgs = import ../nixpkgs-path.nix; eval = import "${nixpkgs}/nixos/lib/eval-config.nix" { inherit system; - modules = [ path ] ++ import ../modules/module-list.nix; + modules = [ path extraConfig ] ++ import ../modules/module-list.nix; }; iso = mkIso "${nixpkgs}/nixos/modules/installer/cd-dvd/iso-image.nix" ( @@ -55,7 +59,7 @@ let }; config = { - imports = [ path ] ++ import ../modules/module-list.nix; + imports = [ path extraConfig ] ++ import ../modules/module-list.nix; }; vm = (import "${nixpkgs}/nixos" { -- cgit 1.4.1