about summary refs log tree commit diff
path: root/nixos/modules/system/boot/systemd.nix
diff options
context:
space:
mode:
authorBenjamin Staffin <benley@gmail.com>2020-06-17 17:22:24 -0400
committerGitHub <noreply@github.com>2020-06-17 17:22:24 -0400
commit19d3665b75f59eb98ca656c2b643a4adc0f0744e (patch)
tree455aed025973e748f264df336d5dc0e7ae40dad5 /nixos/modules/system/boot/systemd.nix
parent13a14e2bfe4ff3b7da222624ce5749218105e465 (diff)
parent19dfc1b01149e5d60860cd0f4b0f8abcb3faabbf (diff)
downloadnixlib-19d3665b75f59eb98ca656c2b643a4adc0f0744e.tar
nixlib-19d3665b75f59eb98ca656c2b643a4adc0f0744e.tar.gz
nixlib-19d3665b75f59eb98ca656c2b643a4adc0f0744e.tar.bz2
nixlib-19d3665b75f59eb98ca656c2b643a4adc0f0744e.tar.lz
nixlib-19d3665b75f59eb98ca656c2b643a4adc0f0744e.tar.xz
nixlib-19d3665b75f59eb98ca656c2b643a4adc0f0744e.tar.zst
nixlib-19d3665b75f59eb98ca656c2b643a4adc0f0744e.zip
Merge branch 'master' into benley/melonDS
Diffstat (limited to 'nixos/modules/system/boot/systemd.nix')
-rw-r--r--nixos/modules/system/boot/systemd.nix9
1 files changed, 7 insertions, 2 deletions
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;