summary refs log tree commit diff
path: root/nixos/modules
diff options
context:
space:
mode:
authorLéo Gaspard <leo@gaspard.io>2017-12-31 03:34:11 +0100
committerLéo Gaspard <leo@gaspard.io>2017-12-31 03:34:11 +0100
commit341583b2d230f810f940dd02cf66ed2298413f70 (patch)
tree3ae9297110131241bbca7a4b1ff395be4df1af54 /nixos/modules
parentade98dc442ea78e9783d5e26954e64ec4a1b2c94 (diff)
downloadnixlib-341583b2d230f810f940dd02cf66ed2298413f70.tar
nixlib-341583b2d230f810f940dd02cf66ed2298413f70.tar.gz
nixlib-341583b2d230f810f940dd02cf66ed2298413f70.tar.bz2
nixlib-341583b2d230f810f940dd02cf66ed2298413f70.tar.lz
nixlib-341583b2d230f810f940dd02cf66ed2298413f70.tar.xz
nixlib-341583b2d230f810f940dd02cf66ed2298413f70.tar.zst
nixlib-341583b2d230f810f940dd02cf66ed2298413f70.zip
fcron module: be compatible with non-wrapped sendmail's, like opensmtpd's
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/services/scheduling/fcron.nix28
1 files changed, 18 insertions, 10 deletions
diff --git a/nixos/modules/services/scheduling/fcron.nix b/nixos/modules/services/scheduling/fcron.nix
index ac589be57736..e3b6b638f5a7 100644
--- a/nixos/modules/services/scheduling/fcron.nix
+++ b/nixos/modules/services/scheduling/fcron.nix
@@ -90,16 +90,24 @@ in
       [ (allowdeny "allow" (cfg.allow))
         (allowdeny "deny" cfg.deny)
         # see man 5 fcron.conf
-        { source = pkgs.writeText "fcron.conf" ''
-            fcrontabs   =       /var/spool/fcron
-            pidfile     =       /var/run/fcron.pid
-            fifofile    =       /var/run/fcron.fifo
-            fcronallow  =       /etc/fcron.allow
-            fcrondeny   =       /etc/fcron.deny
-            shell       =       /bin/sh
-            sendmail    =       /run/wrappers/bin/sendmail
-            editor      =       ${pkgs.vim}/bin/vim
-          '';
+        { source =
+            let
+              isSendmailWrapped =
+                lib.hasAttr "sendmail" config.security.wrappers;
+              sendmailPath =
+                if isSendmailWrapped then "/run/wrappers/bin/sendmail"
+                else "${config.system.path}/bin/sendmail";
+            in
+            pkgs.writeText "fcron.conf" ''
+              fcrontabs   =       /var/spool/fcron
+              pidfile     =       /var/run/fcron.pid
+              fifofile    =       /var/run/fcron.fifo
+              fcronallow  =       /etc/fcron.allow
+              fcrondeny   =       /etc/fcron.deny
+              shell       =       /bin/sh
+              sendmail    =       ${sendmailPath}
+              editor      =       ${pkgs.vim}/bin/vim
+            '';
           target = "fcron.conf";
           gid = config.ids.gids.fcron;
           mode = "0644";