{ mpop, execline, substituteAll, rewrite-paths }:
let
config =
# Mild obfuscation to make sure my email address is not greppable in
# the source by something as primitive as \w+@\w+.\w+. I would be
# shoked if spammer would actually build derivation to grep it for
# email addresses.
# For now I setup maildir instead of mh, since these days I do not
# receive much mail, and configuring mmh is slightly more involved
# than configuring mutt.
let
user = "demigod";
domain = "kaction.cc";
in substituteAll {
src = ./mpop.conf;
account = "user ${user}@${domain}";
};
stage1 = rewrite-paths {
drv = mpop;
postBuild = ''
mv $out/bin/mpop $out/bin/.mpop
cat << EOF > $out/bin/mpop
#!${execline}/bin/execlineb -WS0
$out/bin/.mpop --file=${config} \$@
EOF
chmod +x $out/bin/mpop
'';
};
in stage1