Merge pull request #298983 from illustris/mysql

nixos/systemd-lib: fix restart/reloadTriggers when passing paths

authored by Ryan Hendrickson and committed by GitHub 61153af0 6676e0c0

+16 -2
+3
nixos/doc/manual/release-notes/rl-2405.section.md
··· 351 351 352 352 - Ada packages (libraries and tools) have been moved into the `gnatPackages` scope. `gnatPackages` uses the default GNAT compiler, `gnat12Packages` and `gnat13Packages` use the respective matching compiler version. 353 353 354 + - Paths provided as `restartTriggers` and `reloadTriggers` for systemd units will now be copied into the nix store to make the behavior consistent. 355 + Previously, `restartTriggers = [ ./config.txt ]`, if defined in a flake, would trigger a restart when any part of the flake changed; and if not defined in a flake, would never trigger a restart even if the contents of `config.txt` changed. 356 + 354 357 - `spark2014` has been renamed to `gnatprove`. A version of `gnatprove` matching different GNAT versions is available from the different `gnatPackages` sets. 355 358 356 359 - `services.resolved.fallbackDns` can now be used to disable the upstream fallback servers entirely by setting it to an empty list. To get the previous behaviour of the upstream defaults set it to null, the new default, instead.
+13 -2
nixos/lib/systemd-lib.nix
··· 14 14 elem 15 15 filter 16 16 filterAttrs 17 + flatten 17 18 flip 18 19 head 19 20 isInt 20 21 isList 22 + isPath 21 23 length 22 24 makeBinPath 23 25 makeSearchPathOutput ··· 28 30 optional 29 31 optionalAttrs 30 32 optionalString 33 + pipe 31 34 range 32 35 replaceStrings 33 36 reverseList ··· 366 369 // optionalAttrs (config.requisite != []) 367 370 { Requisite = toString config.requisite; } 368 371 // optionalAttrs (config ? restartTriggers && config.restartTriggers != []) 369 - { X-Restart-Triggers = "${pkgs.writeText "X-Restart-Triggers-${name}" (toString config.restartTriggers)}"; } 372 + { X-Restart-Triggers = "${pkgs.writeText "X-Restart-Triggers-${name}" (pipe config.restartTriggers [ 373 + flatten 374 + (map (x: if isPath x then "${x}" else x)) 375 + toString 376 + ])}"; } 370 377 // optionalAttrs (config ? reloadTriggers && config.reloadTriggers != []) 371 - { X-Reload-Triggers = "${pkgs.writeText "X-Reload-Triggers-${name}" (toString config.reloadTriggers)}"; } 378 + { X-Reload-Triggers = "${pkgs.writeText "X-Reload-Triggers-${name}" (pipe config.reloadTriggers [ 379 + flatten 380 + (map (x: if isPath x then "${x}" else x)) 381 + toString 382 + ])}"; } 372 383 // optionalAttrs (config.description != "") { 373 384 Description = config.description; } 374 385 // optionalAttrs (config.documentation != []) {