summary refs log tree commit diff
path: root/nixos/modules/services/scheduling/atd.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/services/scheduling/atd.nix')
-rw-r--r--nixos/modules/services/scheduling/atd.nix84
1 files changed, 41 insertions, 43 deletions
diff --git a/nixos/modules/services/scheduling/atd.nix b/nixos/modules/services/scheduling/atd.nix
index c6f128ec402..2070b2ffa01 100644
--- a/nixos/modules/services/scheduling/atd.nix
+++ b/nixos/modules/services/scheduling/atd.nix
@@ -66,49 +66,47 @@ in
         gid = config.ids.gids.atd;
       };
 
-    jobs.atd =
-      { description = "Job Execution Daemon (atd)";
-
-        startOn = "stopped udevtrigger";
-
-        path = [ at ];
-
-        preStart =
-          ''
-            # Snippets taken and adapted from the original `install' rule of
-            # the makefile.
-
-            # We assume these values are those actually used in Nixpkgs for
-            # `at'.
-            spooldir=/var/spool/atspool
-            jobdir=/var/spool/atjobs
-            etcdir=/etc/at
-
-            for dir in "$spooldir" "$jobdir" "$etcdir"; do
-              if [ ! -d "$dir" ]; then
-                  mkdir -p "$dir"
-                  chown atd:atd "$dir"
-              fi
-            done
-            chmod 1770 "$spooldir" "$jobdir"
-            ${if cfg.allowEveryone then ''chmod a+rwxt "$spooldir" "$jobdir" '' else ""}
-            if [ ! -f "$etcdir"/at.deny ]; then
-                touch "$etcdir"/at.deny
-                chown root:atd "$etcdir"/at.deny
-                chmod 640 "$etcdir"/at.deny
-            fi
-            if [ ! -f "$jobdir"/.SEQ ]; then
-                touch "$jobdir"/.SEQ
-                chown atd:atd "$jobdir"/.SEQ
-                chmod 600 "$jobdir"/.SEQ
-            fi
-          '';
-
-        exec = "atd";
-
-        daemonType = "fork";
-      };
+    systemd.services.atd = {
+      description = "Job Execution Daemon (atd)";
+      after = [ "systemd-udev-settle.service" ];
+      wants = [ "systemd-udev-settle.service" ];
+      wantedBy = [ "multi-user.target" ];
+
+      path = [ at ];
+
+      preStart = ''
+        # Snippets taken and adapted from the original `install' rule of
+        # the makefile.
+
+        # We assume these values are those actually used in Nixpkgs for
+        # `at'.
+        spooldir=/var/spool/atspool
+        jobdir=/var/spool/atjobs
+        etcdir=/etc/at
+
+        for dir in "$spooldir" "$jobdir" "$etcdir"; do
+          if [ ! -d "$dir" ]; then
+              mkdir -p "$dir"
+              chown atd:atd "$dir"
+          fi
+        done
+        chmod 1770 "$spooldir" "$jobdir"
+        ${if cfg.allowEveryone then ''chmod a+rwxt "$spooldir" "$jobdir" '' else ""}
+        if [ ! -f "$etcdir"/at.deny ]; then
+            touch "$etcdir"/at.deny
+            chown root:atd "$etcdir"/at.deny
+            chmod 640 "$etcdir"/at.deny
+        fi
+        if [ ! -f "$jobdir"/.SEQ ]; then
+            touch "$jobdir"/.SEQ
+            chown atd:atd "$jobdir"/.SEQ
+            chmod 600 "$jobdir"/.SEQ
+        fi
+      '';
 
-  };
+      script = "atd";
 
+      serviceConfig.Type = "forking";
+    };
+  };
 }