systemd: use listsAsDuplicateKeys
This causes list values to be emitted as a list of key-value pairs instead of a single key-value pair where the value is space separated. This is useful, e.g., for socket units that would like to specify more than one `ListenStream=` address.
This commit is contained in:
parent
abaebf3b34
commit
28eb093a1e
|
@ -14,6 +14,7 @@ let
|
||||||
|| cfg.sessionVariables != {};
|
|| cfg.sessionVariables != {};
|
||||||
|
|
||||||
toSystemdIni = generators.toINI {
|
toSystemdIni = generators.toINI {
|
||||||
|
listsAsDuplicateKeys = true;
|
||||||
mkKeyValue = key: value:
|
mkKeyValue = key: value:
|
||||||
let
|
let
|
||||||
value' =
|
value' =
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
[Service]
|
|
||||||
ExecStart=/some/exec/start/command --with-arguments "%i"
|
|
||||||
|
|
||||||
[Unit]
|
|
||||||
Description=A basic test service
|
|
|
@ -10,6 +10,7 @@ with lib;
|
||||||
};
|
};
|
||||||
|
|
||||||
Service = {
|
Service = {
|
||||||
|
Environment = [ "VAR1=1" "VAR2=2" ];
|
||||||
ExecStart = ''/some/exec/start/command --with-arguments "%i"'';
|
ExecStart = ''/some/exec/start/command --with-arguments "%i"'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -17,7 +18,16 @@ with lib;
|
||||||
nmt.script = ''
|
nmt.script = ''
|
||||||
serviceFile=home-files/.config/systemd/user/test-service@.service
|
serviceFile=home-files/.config/systemd/user/test-service@.service
|
||||||
assertFileExists $serviceFile
|
assertFileExists $serviceFile
|
||||||
assertFileContent $serviceFile ${./services-expected.conf}
|
assertFileContent $serviceFile \
|
||||||
|
${builtins.toFile "services-expected.conf" ''
|
||||||
|
[Service]
|
||||||
|
Environment=VAR1=1
|
||||||
|
Environment=VAR2=2
|
||||||
|
ExecStart=/some/exec/start/command --with-arguments "%i"
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
Description=A basic test service
|
||||||
|
''}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue