diff --git a/nixos/modules/services/mail/opensmtpd.nix b/nixos/modules/services/mail/opensmtpd.nix index d1f944ac88eb..2fc628a64aeb 100644 --- a/nixos/modules/services/mail/opensmtpd.nix +++ b/nixos/modules/services/mail/opensmtpd.nix @@ -113,11 +113,13 @@ in source = "${cfg.package}/bin/smtpctl"; }; - services.mail.sendmailSetuidWrapper = lib.mkIf cfg.setSendmail - (security.wrappers.smtpctl // { + services.mail.sendmailSetuidWrapper = lib.mkIf cfg.setSendmail ( + security.wrappers.smtpctl + // { source = "${sendmail}/bin/sendmail"; program = "sendmail"; - }); + } + ); systemd.tmpfiles.rules = [ "d /var/spool/smtpd 711 root - - -" diff --git a/nixos/tests/opensmtpd.nix b/nixos/tests/opensmtpd.nix index 483464362fa7..e1c26a7c6775 100644 --- a/nixos/tests/opensmtpd.nix +++ b/nixos/tests/opensmtpd.nix @@ -16,24 +16,26 @@ import ./make-test-python.nix { } ]; }; - environment.systemPackages = let - testSendmail = pkgs.writeScriptBin "test-sendmail" '' - #!/bin/sh - set -euxo pipefail - echo "========= SENDING" >&2 - ${pkgs.system-sendmail}/bin/sendmail -v -f alice@smtp1 bob@smtp2 >&2 <&2 + ${pkgs.system-sendmail}/bin/sendmail -v -f alice@smtp1 bob@smtp2 >&2 <&2 - ''; - in [ - pkgs.opensmtpd - testSendmail - ]; + Hello World + EOF + echo "=========== FINISHED SENDING" >&2 + ''; + in + [ + pkgs.opensmtpd + testSendmail + ]; services.opensmtpd = { enable = true; extraServerArgs = [ "-v" ];