mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 11:39:46 +01:00
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
3 changed files with 12 additions and 6 deletions
|
@ -14,6 +14,7 @@ let
|
|||
|| cfg.sessionVariables != {};
|
||||
|
||||
toSystemdIni = generators.toINI {
|
||||
listsAsDuplicateKeys = true;
|
||||
mkKeyValue = key: value:
|
||||
let
|
||||
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 = {
|
||||
Environment = [ "VAR1=1" "VAR2=2" ];
|
||||
ExecStart = ''/some/exec/start/command --with-arguments "%i"'';
|
||||
};
|
||||
};
|
||||
|
@ -17,7 +18,16 @@ with lib;
|
|||
nmt.script = ''
|
||||
serviceFile=home-files/.config/systemd/user/test-service@.service
|
||||
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