diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index f70efeca4b9..5f07d6482b7 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -637,7 +637,8 @@ in config = { assertions = mapAttrsToList (name: service: { - assertion = service.serviceConfig.Type or "" == "oneshot" -> service.serviceConfig.Restart or "no" == "no"; + assertion = service.serviceConfig.Type or "" == "oneshot" -> + builtins.elem (service.serviceConfig.Restart or "no") ["no" "on-failure" "on-abort"]; message = "${name}: Type=oneshot services must have Restart=no"; }) cfg.services;