nixpkgs/pkgs/servers/maddy/default.nix
Flakebi f342d3f29a
maddy: enable pam support
This allows to use pam for user authentication.
2022-11-25 22:53:36 +01:00

55 lines
1.5 KiB
Nix

{ lib, buildGoModule, fetchFromGitHub, pam, coreutils, installShellFiles, scdoc, nixosTests }:
buildGoModule rec {
pname = "maddy";
version = "0.6.2";
src = fetchFromGitHub {
owner = "foxcpp";
repo = "maddy";
rev = "v${version}";
sha256 = "sha256-DBSqC4EteESYb6RbC2xyS+6YczGviWYnyMz7QvCO3Uc=";
};
vendorSha256 = "sha256-10cLNl9jWYX8XIKQkCxJ+/ymZC1YJRHUJWZQhq7zeV4=";
tags = [ "libpam" ];
ldflags = [ "-s" "-w" "-X github.com/foxcpp/maddy.Version=${version}" ];
subPackages = [ "cmd/maddy" ];
buildInputs = [ pam ];
nativeBuildInputs = [ installShellFiles scdoc ];
postInstall = ''
for f in docs/man/*.scd; do
local page="docs/man/$(basename "$f" .scd)"
scdoc < "$f" > "$page"
installManPage "$page"
done
ln -s "$out/bin/maddy" "$out/bin/maddyctl"
mkdir -p $out/lib/systemd/system
substitute dist/systemd/maddy.service $out/lib/systemd/system/maddy.service \
--replace "/usr/local/bin/maddy" "$out/bin/maddy" \
--replace "/bin/kill" "${coreutils}/bin/kill"
substitute dist/systemd/maddy@.service $out/lib/systemd/system/maddy@.service \
--replace "/usr/local/bin/maddy" "$out/bin/maddy" \
--replace "/bin/kill" "${coreutils}/bin/kill"
'';
passthru.tests.nixos = nixosTests.maddy;
meta = with lib; {
description = "Composable all-in-one mail server";
homepage = "https://maddy.email";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ nickcao ];
};
}