Merge pull request #90604 from maralorn/systemd-oneshot-warning

nixos/systemd: Update warning for restarting oneshots

authored by Florian Klink and committed by GitHub d7253016 dcf36b65

+7 -2
+7 -2
nixos/modules/system/boot/systemd.nix
··· 826 826 config = { 827 827 828 828 warnings = concatLists (mapAttrsToList (name: service: 829 - optional (service.serviceConfig.Type or "" == "oneshot" && service.serviceConfig.Restart or "no" != "no") 830 - "Service ‘${name}.service’ with ‘Type=oneshot’ must have ‘Restart=no’") cfg.services); 829 + let 830 + type = service.serviceConfig.Type or ""; 831 + restart = service.serviceConfig.Restart or "no"; 832 + in optional 833 + (type == "oneshot" && (restart == "always" || restart == "on-success")) 834 + "Service '${name}.service' with 'Type=oneshot' cannot have 'Restart=always' or 'Restart=on-success'") 835 + cfg.services); 831 836 832 837 system.build.units = cfg.units; 833 838