2022-01-06 00:23:37 +00:00
|
|
|
{ lib, buildGoModule, fetchFromGitHub, pam, coreutils, installShellFiles, scdoc, nixosTests }:
|
2021-02-05 10:14:31 +00:00
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "maddy";
|
2022-06-24 09:12:48 +00:00
|
|
|
version = "0.6.2";
|
2021-02-05 10:14:31 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "foxcpp";
|
|
|
|
repo = "maddy";
|
|
|
|
rev = "v${version}";
|
2022-06-24 09:12:48 +00:00
|
|
|
sha256 = "sha256-DBSqC4EteESYb6RbC2xyS+6YczGviWYnyMz7QvCO3Uc=";
|
2021-02-05 10:14:31 +00:00
|
|
|
};
|
|
|
|
|
2022-06-24 09:12:48 +00:00
|
|
|
vendorSha256 = "sha256-10cLNl9jWYX8XIKQkCxJ+/ymZC1YJRHUJWZQhq7zeV4=";
|
2021-02-05 10:14:31 +00:00
|
|
|
|
2022-01-06 00:23:37 +00:00
|
|
|
tags = [ "libpam" ];
|
|
|
|
|
2021-08-26 06:45:51 +00:00
|
|
|
ldflags = [ "-s" "-w" "-X github.com/foxcpp/maddy.Version=${version}" ];
|
2021-02-05 10:14:31 +00:00
|
|
|
|
2022-06-24 09:12:48 +00:00
|
|
|
subPackages = [ "cmd/maddy" ];
|
2021-02-05 10:14:31 +00:00
|
|
|
|
2022-01-06 00:23:37 +00:00
|
|
|
buildInputs = [ pam ];
|
|
|
|
|
2021-10-12 08:00:56 +00:00
|
|
|
nativeBuildInputs = [ installShellFiles scdoc ];
|
|
|
|
|
2021-09-11 13:12:19 +00:00
|
|
|
postInstall = ''
|
2021-10-12 08:00:56 +00:00
|
|
|
for f in docs/man/*.scd; do
|
|
|
|
local page="docs/man/$(basename "$f" .scd)"
|
|
|
|
scdoc < "$f" > "$page"
|
|
|
|
installManPage "$page"
|
|
|
|
done
|
|
|
|
|
2022-06-24 09:12:48 +00:00
|
|
|
ln -s "$out/bin/maddy" "$out/bin/maddyctl"
|
|
|
|
|
2021-09-11 13:12:19 +00:00
|
|
|
mkdir -p $out/lib/systemd/system
|
|
|
|
|
|
|
|
substitute dist/systemd/maddy.service $out/lib/systemd/system/maddy.service \
|
2021-10-15 08:59:39 +00:00
|
|
|
--replace "/usr/local/bin/maddy" "$out/bin/maddy" \
|
2021-09-11 13:12:19 +00:00
|
|
|
--replace "/bin/kill" "${coreutils}/bin/kill"
|
|
|
|
|
|
|
|
substitute dist/systemd/maddy@.service $out/lib/systemd/system/maddy@.service \
|
2021-10-15 08:59:39 +00:00
|
|
|
--replace "/usr/local/bin/maddy" "$out/bin/maddy" \
|
2021-09-11 13:12:19 +00:00
|
|
|
--replace "/bin/kill" "${coreutils}/bin/kill"
|
|
|
|
'';
|
|
|
|
|
2021-09-10 11:08:58 +00:00
|
|
|
passthru.tests.nixos = nixosTests.maddy;
|
|
|
|
|
2021-02-05 10:14:31 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Composable all-in-one mail server";
|
2021-09-19 10:02:04 +00:00
|
|
|
homepage = "https://maddy.email";
|
2021-02-05 10:14:31 +00:00
|
|
|
license = licenses.gpl3Plus;
|
2021-10-12 08:00:56 +00:00
|
|
|
maintainers = with maintainers; [ nickcao ];
|
2021-02-05 10:14:31 +00:00
|
|
|
};
|
|
|
|
}
|