summary refs log tree commit diff
path: root/nixos/modules/system
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2017-05-21 19:23:09 +0100
committerJörg Thalheim <joerg@thalheim.io>2017-05-27 08:27:39 +0100
commit522c16bd8669dd2d71fd4c01b2b2fe02a0a7a02c (patch)
tree94019089c27efbf9449a695051ee62ccda1efdbd /nixos/modules/system
parentdcc6a69bae7fea22a4d274e03171934c133090c9 (diff)
downloadnixpkgs-522c16bd8669dd2d71fd4c01b2b2fe02a0a7a02c.tar
nixpkgs-522c16bd8669dd2d71fd4c01b2b2fe02a0a7a02c.tar.gz
nixpkgs-522c16bd8669dd2d71fd4c01b2b2fe02a0a7a02c.tar.bz2
nixpkgs-522c16bd8669dd2d71fd4c01b2b2fe02a0a7a02c.tar.lz
nixpkgs-522c16bd8669dd2d71fd4c01b2b2fe02a0a7a02c.tar.xz
nixpkgs-522c16bd8669dd2d71fd4c01b2b2fe02a0a7a02c.tar.zst
nixpkgs-522c16bd8669dd2d71fd4c01b2b2fe02a0a7a02c.zip
systemd-nspawn: fixes evaluation error
fixes #25097
Diffstat (limited to 'nixos/modules/system')
-rw-r--r--nixos/modules/system/boot/systemd-nspawn.nix25
1 files changed, 13 insertions, 12 deletions
diff --git a/nixos/modules/system/boot/systemd-nspawn.nix b/nixos/modules/system/boot/systemd-nspawn.nix
index b462822bc2f..600f3a83071 100644
--- a/nixos/modules/system/boot/systemd-nspawn.nix
+++ b/nixos/modules/system/boot/systemd-nspawn.nix
@@ -42,8 +42,7 @@ let
   ];
 
   instanceOptions = {
-    options = {
-
+    options = sharedOptions // {
       execConfig = mkOption {
         default = {};
         example = { Parameters = "/bin/sh"; };
@@ -84,17 +83,19 @@ let
   };
 
   instanceToUnit = name: def:
-    { text = ''
-      [Exec]
-      ${attrsToSection def.execConfig}
+    let base = {
+      text = ''
+        [Exec]
+        ${attrsToSection def.execConfig}
 
-      [Files]
-      ${attrsToSection def.filesConfig}
+        [Files]
+        ${attrsToSection def.filesConfig}
 
-      [Network]
-      ${attrsToSection def.networkConfig}
-    '';
-    };
+        [Network]
+        ${attrsToSection def.networkConfig}
+      '';
+    } // def;
+    in base // { unit = makeUnit name base; };
 
 in {
 
@@ -110,7 +111,7 @@ in {
 
   config =
     let
-      units = mapAttrs' (n: v: nameValuePair "${n}.nspawn" (instanceToUnit n v)) cfg.instances;
+      units = mapAttrs' (n: v: nameValuePair "${n}.nspawn" (instanceToUnit n v)) cfg;
     in mkIf (cfg != {}) {
 
       environment.etc."systemd/nspawn".source = generateUnits "nspawn" units [] [];