diff options
author | Florian Klink <flokli@flokli.de> | 2020-06-16 23:35:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-16 23:35:22 +0200 |
commit | d72530162a70aa8fdd10e8351a88c8f08ac14e8e (patch) | |
tree | 6d90b35a48229440005cb3a229d6dccc84abc465 /nixos | |
parent | dcf36b65c3f9c2753bc51d4e45fce4f98b823c31 (diff) | |
parent | 0d4134de4a3436fabf7ea8afbac3c0a3028d0fbb (diff) |
Merge pull request #90604 from maralorn/systemd-oneshot-warning
nixos/systemd: Update warning for restarting oneshots
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/system/boot/systemd.nix | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index 99892a28115c9..a8e51fc09014d 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -826,8 +826,13 @@ in config = { warnings = concatLists (mapAttrsToList (name: service: - optional (service.serviceConfig.Type or "" == "oneshot" && service.serviceConfig.Restart or "no" != "no") - "Service ‘${name}.service’ with ‘Type=oneshot’ must have ‘Restart=no’") cfg.services); + let + type = service.serviceConfig.Type or ""; + restart = service.serviceConfig.Restart or "no"; + in optional + (type == "oneshot" && (restart == "always" || restart == "on-success")) + "Service '${name}.service' with 'Type=oneshot' cannot have 'Restart=always' or 'Restart=on-success'") + cfg.services); system.build.units = cfg.units; |