diff options
author | Robin Gloster <mail@glob.in> | 2016-01-06 06:50:18 +0000 |
---|---|---|
committer | Robin Gloster <mail@glob.in> | 2016-01-07 06:39:06 +0000 |
commit | 88292fdf09960e9cb8e3c063a6b95ac4284222ec (patch) | |
tree | 34ff267ed7bacf9fd906b1736476b431e9afe909 /nixos/modules/services/scheduling | |
parent | af50b03f50d88954e98018c7c18c0581928b7165 (diff) |
jobs -> systemd.services
Diffstat (limited to 'nixos/modules/services/scheduling')
-rw-r--r-- | nixos/modules/services/scheduling/atd.nix | 84 | ||||
-rw-r--r-- | nixos/modules/services/scheduling/fcron.nix | 38 |
2 files changed, 58 insertions, 64 deletions
diff --git a/nixos/modules/services/scheduling/atd.nix b/nixos/modules/services/scheduling/atd.nix index c6f128ec40260..2070b2ffa0186 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"; + }; + }; } diff --git a/nixos/modules/services/scheduling/fcron.nix b/nixos/modules/services/scheduling/fcron.nix index ade8c19329ca8..7b4665a820467 100644 --- a/nixos/modules/services/scheduling/fcron.nix +++ b/nixos/modules/services/scheduling/fcron.nix @@ -108,29 +108,25 @@ in security.setuidPrograms = [ "fcrontab" ]; - jobs.fcron = - { description = "fcron daemon"; - - startOn = "startup"; - - after = [ "local-fs.target" ]; - - environment = - { PATH = "/run/current-system/sw/bin"; - }; - - preStart = - '' - ${pkgs.coreutils}/bin/mkdir -m 0700 -p /var/spool/fcron - # load system crontab file - ${pkgs.fcron}/bin/fcrontab -u systab ${pkgs.writeText "systab" cfg.systab} - ''; + systemd.services.fcron = { + description = "fcron daemon"; + after = [ "local-fs.target" ]; + wantedBy = [ "multi-user.target" ]; + + # FIXME use specific path + environment = { + PATH = "/run/current-system/sw/bin"; + }; - daemonType = "fork"; + preStart = '' + ${pkgs.coreutils}/bin/mkdir -m 0700 -p /var/spool/fcron + # load system crontab file + ${pkgs.fcron}/bin/fcrontab -u systab ${pkgs.writeText "systab" cfg.systab} + ''; - exec = "${pkgs.fcron}/sbin/fcron -m ${toString cfg.maxSerialJobs} ${queuelen}"; - }; + serviceConfig.Type = "forking"; + script = "${pkgs.fcron}/sbin/fcron -m ${toString cfg.maxSerialJobs} ${queuelen}"; + }; }; - } |