mirror of
https://git.sr.ht/~magic_rb/cluster
synced 2024-11-22 08:04:20 +01:00
38940ad5a9
Signed-off-by: Magic_RB <magic_rb@redalder.org>
97 lines
3 KiB
Nix
97 lines
3 KiB
Nix
{ nglib, nixpkgs }:
|
|
nglib.makeSystem {
|
|
system = "x86_64-linux";
|
|
name = "ra-systems-getmail";
|
|
inherit nixpkgs;
|
|
config = ({ pkgs, config, nglib, lib, ... }:
|
|
{
|
|
config = {
|
|
dumb-init = {
|
|
enable = true;
|
|
type.services = {};
|
|
};
|
|
|
|
users.users."vmail" = {
|
|
uid = config.ids.uids.vmail;
|
|
description = "vmail user.";
|
|
group = "vmail";
|
|
shell = "${pkgs.bash}/bin/bash";
|
|
};
|
|
users.groups."vmail" = {
|
|
gid = config.ids.gids.vmail;
|
|
};
|
|
|
|
init.services.getmail =
|
|
let
|
|
courier-unicode = with pkgs;
|
|
stdenv.mkDerivation rec {
|
|
name = "courier-unicode";
|
|
version = "2.2.3";
|
|
|
|
src = pkgs.fetchurl {
|
|
url = "mirror://sourceforge/courier/courier-unicode/${version}/${name}-${version}.tar.bz2";
|
|
sha256 = "sha256-COz13JdSnOOqncqghYYHYt5jbr75aL9LbgzfqvGMev8=";
|
|
};
|
|
|
|
nativeBuildInputs = [ perl ];
|
|
};
|
|
maildrop-fixed = pkgs.maildrop.overrideAttrs (
|
|
old:
|
|
{ patches =
|
|
[ ./dont-reset-path.patch
|
|
./maildrop.configure.hack.patch
|
|
];
|
|
version = "3.0.7";
|
|
src = pkgs.fetchurl {
|
|
url = "mirror://sourceforge/courier/maildrop/3.0.7/maildrop-3.0.7.tar.bz2";
|
|
sha256 = "sha256-YFzoHDk5BEcy2uRyQhlTTl27UVyAdgvjYRkUq1wfeCU=";
|
|
};
|
|
nativeBuildInputs = with pkgs; [ pcre2 pkg-config ];
|
|
buildInputs = with pkgs; [ libidn courier-unicode ];
|
|
});
|
|
|
|
getmail6-fixed = pkgs.getmail6.overrideAttrs (
|
|
old:
|
|
{ patches =
|
|
[ ./getmail-read-exec-from-path.patch
|
|
];
|
|
}
|
|
);
|
|
in
|
|
{
|
|
shutdownOnExit = true;
|
|
script = pkgs.writeShellScript "getmail-run"
|
|
''
|
|
export PATH=${with pkgs; lib.makeBinPath [ busybox runit bash getmail6-fixed maildrop-fixed ]}:${pkgs.opensmtpd}/libexec/opensmtpd:$PATH
|
|
|
|
chown vmail:vmail -R /getmail.d
|
|
|
|
set -m
|
|
|
|
for rcfile in /mail-configuration/getmail.d/*.rc
|
|
do
|
|
filename="$(basename "''${rcfile}")"
|
|
email="''${filename%".rc"}"
|
|
|
|
mkdir -p "/getmail.d/''${email}"
|
|
chown vmail:vmail -R "/getmail.d/''${email}"
|
|
|
|
(
|
|
while true
|
|
do
|
|
chpst -u vmail:vmail getmail -i INBOX -n -r "$rcfile" --getmaildir "/mail-configuration/getmail.d/''${email}"
|
|
sleep 10
|
|
done
|
|
) &
|
|
done
|
|
|
|
wait
|
|
'';
|
|
enabled = true;
|
|
};
|
|
};
|
|
});
|
|
}
|
|
|
|
# /usr/lib/sendmail -i -oem -f %F %T
|