3
0
Fork 0
forked from mirrors/nixpkgs

nixos/lib: hash triggers after converting them to string in systemd-lib

This change is made for two reasons:

1.  If `toString config.restartTriggers` containes `\n`, systemd unit
    file will be ill-formed.
2.  This change can limit length of the trigger, although it doesn't
    matter in most cases.
This commit is contained in:
wrvsrx 2023-05-06 19:05:45 +08:00
parent 12d1034a34
commit cc41b47c6f
No known key found for this signature in database
GPG key ID: 8BCC6FC7D2BDCB3B

View file

@ -289,9 +289,9 @@ in rec {
// optionalAttrs (config.requisite != [])
{ Requisite = toString config.requisite; }
// optionalAttrs (config ? restartTriggers && config.restartTriggers != [])
{ X-Restart-Triggers = toString config.restartTriggers; }
{ X-Restart-Triggers = builtins.hashString "sha512" (toString config.restartTriggers); }
// optionalAttrs (config ? reloadTriggers && config.reloadTriggers != [])
{ X-Reload-Triggers = toString config.reloadTriggers; }
{ X-Reload-Triggers = builtins.hashString "sha512" (toString config.reloadTriggers); }
// optionalAttrs (config.description != "") {
Description = config.description; }
// optionalAttrs (config.documentation != []) {