2021-01-11 07:54:33 +00:00
|
|
|
{ lib, stdenv, writeText, runtimeShell }:
|
2018-10-27 10:33:43 +01:00
|
|
|
|
|
|
|
let script = writeText "script" ''
|
2019-02-26 11:45:54 +00:00
|
|
|
#!${runtimeShell}
|
2018-10-27 10:33:43 +01:00
|
|
|
|
|
|
|
if command -v sendmail > /dev/null 2>&1 && [ "$(command -v sendmail)" != "{{MYPATH}}" ]; then
|
|
|
|
exec sendmail "$@"
|
|
|
|
elif [ -x /run/wrappers/bin/sendmail ]; then
|
|
|
|
exec /run/wrappers/bin/sendmail "$@"
|
|
|
|
elif [ -x /run/current-system/sw/bin/sendmail ]; then
|
|
|
|
exec /run/current-system/sw/bin/sendmail "$@"
|
|
|
|
else
|
|
|
|
echo "Unable to find system sendmail." >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
''; in
|
|
|
|
stdenv.mkDerivation {
|
2021-05-23 16:07:31 +01:00
|
|
|
pname = "system-sendmail";
|
|
|
|
version = "1.0";
|
2018-10-27 10:33:43 +01:00
|
|
|
|
|
|
|
src = script;
|
|
|
|
|
2021-07-22 17:52:34 +01:00
|
|
|
dontUnpack = true;
|
|
|
|
dontInstall = true;
|
|
|
|
|
2018-10-27 10:33:43 +01:00
|
|
|
buildPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
< $src sed "s#{{MYPATH}}#$out/bin/sendmail#" > $out/bin/sendmail
|
|
|
|
chmod +x $out/bin/sendmail
|
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2018-10-27 10:33:43 +01:00
|
|
|
description = ''
|
|
|
|
A sendmail wrapper that calls the system sendmail. Do not install as system-wide sendmail!
|
|
|
|
'';
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ ekleog ];
|
2022-04-01 20:34:55 +01:00
|
|
|
mainProgram = "sendmail";
|
2018-10-27 10:33:43 +01:00
|
|
|
};
|
|
|
|
}
|