From 522c16bd8669dd2d71fd4c01b2b2fe02a0a7a02c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io> Date: Sun, 21 May 2017 19:23:09 +0100 Subject: [PATCH] systemd-nspawn: fixes evaluation error fixes #25097 --- nixos/modules/system/boot/systemd-nspawn.nix | 25 ++++++++++---------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/nixos/modules/system/boot/systemd-nspawn.nix b/nixos/modules/system/boot/systemd-nspawn.nix index b462822bc2fe..600f3a830711 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 [] [];