Skip to content

Commit 18e4687

Browse files
committedJun 7, 2017
systemd-nspawn: fixes evaluation error
fixes #25097 (cherry picked from commit 522c16b)
1 parent d3b66f9 commit 18e4687

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed
 

‎nixos/modules/system/boot/systemd-nspawn.nix

+14-13
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ let
4141
];
4242

4343
instanceOptions = {
44-
options = {
45-
44+
options = sharedOptions // {
4645
execConfig = mkOption {
4746
default = {};
4847
example = { Parameters = "/bin/sh"; };
@@ -82,18 +81,20 @@ let
8281

8382
};
8483

85-
instanceToUnit = name: def:
86-
{ text = ''
87-
[Exec]
88-
${attrsToSection def.execConfig}
84+
instanceToUnit = name: def:
85+
let base = {
86+
text = ''
87+
[Exec]
88+
${attrsToSection def.execConfig}
8989
90-
[Files]
91-
${attrsToSection def.filesConfig}
90+
[Files]
91+
${attrsToSection def.filesConfig}
9292
93-
[Network]
94-
${attrsToSection def.networkConfig}
95-
'';
96-
};
93+
[Network]
94+
${attrsToSection def.networkConfig}
95+
'';
96+
} // def;
97+
in base // { unit = makeUnit name base; };
9798

9899
in {
99100

@@ -109,7 +110,7 @@ in {
109110

110111
config =
111112
let
112-
units = mapAttrs' (n: v: nameValuePair "${n}.nspawn" (instanceToUnit n v)) cfg.instances;
113+
units = mapAttrs' (n: v: nameValuePair "${n}.nspawn" (instanceToUnit n v)) cfg;
113114
in mkIf (cfg != {}) {
114115

115116
environment.etc."systemd/nspawn".source = generateUnits "nspawn" units [] [];

0 commit comments

Comments
 (0)
Please sign in to comment.