about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2016-05-03 00:47:45 +0200
committeraszlig <aszlig@redmoonstudios.org>2016-05-03 02:48:54 +0200
commit23a12bf4ba8cd9ac145a548cd8eb58a39b5abad8 (patch)
tree7cc35b19c782430e7b5722415246548f80ef5861 /lib
parentbdb9fab33884733d18765741db8141d7e166ae4b (diff)
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 <aszlig@redmoonstudios.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/call-machine.nix10
1 files changed, 7 insertions, 3 deletions
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" {