Subject: [bug#59701] [PATCH] gnu: mailutils: Inform correct path of sendmail.

From: EuAndreh <[email-masked]>
Date: Thu, 1 Dec 2022 10:30:46 +0000

> Can we change that value to $PATH? I checked and I don't have sendmail
> in /run/setuid-programs, and I know I'd use my msmtp setup for sendmail
> *for myself* but not for the system if it were available.

With mailutils, I'm afraid this can't be done.

What our Nix friends do is have a module (which is equivalent to a Guix 
service) that accepts a "setSendmail" option [0] which, when true, adds 
the a setuid msmtp binary wrapper [1].

That mixes up user-level and system-level configuration, and the only 
way around is add a user-level alias wrapper for mailutils wrapper that
specifies where to find sendmail at runtime:

     alias mail="mail -E'set 
sendmail=\"$HOME/.guix-home/profile/bin/msmtp\"'"

Doing this to the mailutils package definition would require juggling 
some options around and knowing very well how mailutils handles options, 
so that the dynamic lookup of the sendmail binary doesn't break anything 
else.

[0]: 
https://github.com/NixOS/nixpkgs/blob/353a64f7bac4230a46dfa47a6212902c622b98a2/nixos/modules/programs/msmtp.nix#L15
[1]: 
https://github.com/NixOS/nixpkgs/blob/353a64f7bac4230a46dfa47a6212902c622b98a2/nixos/modules/programs/msmtp.nix#L76