From 0d4134de4a3436fabf7ea8afbac3c0a3028d0fbb Mon Sep 17 00:00:00 2001 From: Malte Brandy Date: Tue, 16 Jun 2020 14:34:03 +0200 Subject: nixos/systemd: Update warning for restarting oneshots Restart= can be anything other than on-success and always for onehost units as of https://github.com/systemd/systemd/pull/13754/commits/10e72727eeeeb1a495303ec406fa8d1e1a83dc6e which is contained in systemd 245. --- nixos/modules/system/boot/systemd.nix | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'nixos/modules/system/boot/systemd.nix') diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index 99892a28115c..a8e51fc09014 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; -- cgit 1.4.1