mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-03-16 17:13:21 +00:00
parent
dcc6a69bae
commit
522c16bd86
|
@ -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 [] [];
|
||||
|
|
Loading…
Reference in a new issue