rss2email module: init

Also adding `system-sendmail` package for sharing the code with other
modules or packages needing it.
This commit is contained in:
Léo Gaspard
2018-10-27 18:33:43 +09:00
parent 4b5ffcb964
commit 0483ce0eee
9 changed files with 266 additions and 2 deletions

View File

@@ -0,0 +1,36 @@
{ stdenv, writeText }:
let script = writeText "script" ''
#!/bin/sh
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 {
name = "system-sendmail-1.0";
src = script;
phases = [ "buildPhase" ];
buildPhase = ''
mkdir -p $out/bin
< $src sed "s#{{MYPATH}}#$out/bin/sendmail#" > $out/bin/sendmail
chmod +x $out/bin/sendmail
'';
meta = with stdenv.lib; {
description = ''
A sendmail wrapper that calls the system sendmail. Do not install as system-wide sendmail!
'';
platforms = platforms.unix;
maintainers = with maintainers; [ ekleog ];
};
}