nixpkgs-suyu/pkgs/servers/maddy/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

66 lines
1.6 KiB
Nix
Raw Normal View History

2023-11-22 15:44:27 +01:00
{ lib
, stdenv
, buildGoModule
, fetchFromGitHub
, pam
, coreutils
, installShellFiles
, scdoc
, nixosTests
}:
2021-02-05 11:14:31 +01:00
buildGoModule rec {
pname = "maddy";
2024-01-24 10:20:49 +01:00
version = "0.7.1";
2021-02-05 11:14:31 +01:00
src = fetchFromGitHub {
owner = "foxcpp";
repo = "maddy";
rev = "v${version}";
2024-01-24 10:20:49 +01:00
sha256 = "sha256-jVlIjeBvxc82GQn8vW2RqcAErxZqftGj32d+IbBxQxY=";
2021-02-05 11:14:31 +01:00
};
2024-01-24 10:20:49 +01:00
vendorHash = "sha256-bSBk68w6T/Wy5klj5oC/ZW5TqDESG3mW9cIQ3auNmCk=";
2021-02-05 11:14:31 +01:00
tags = [ "libpam" ];
2021-08-26 08:45:51 +02:00
ldflags = [ "-s" "-w" "-X github.com/foxcpp/maddy.Version=${version}" ];
2021-02-05 11:14:31 +01:00
2022-06-24 11:12:48 +02:00
subPackages = [ "cmd/maddy" ];
2021-02-05 11:14:31 +01:00
buildInputs = [ pam ];
2021-10-12 10:00:56 +02:00
nativeBuildInputs = [ installShellFiles scdoc ];
2021-09-11 15:12:19 +02:00
postInstall = ''
2021-10-12 10:00:56 +02:00
for f in docs/man/*.scd; do
local page="docs/man/$(basename "$f" .scd)"
scdoc < "$f" > "$page"
installManPage "$page"
done
2022-06-24 11:12:48 +02:00
ln -s "$out/bin/maddy" "$out/bin/maddyctl"
2021-09-11 15:12:19 +02:00
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" \
2021-09-11 15:12:19 +02:00
--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" \
2021-09-11 15:12:19 +02:00
--replace "/bin/kill" "${coreutils}/bin/kill"
'';
2023-11-22 15:44:27 +01:00
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=strict-prototypes";
passthru.tests.nixos = nixosTests.maddy;
2021-02-05 11:14:31 +01:00
meta = with lib; {
description = "Composable all-in-one mail server";
homepage = "https://maddy.email";
2021-02-05 11:14:31 +01:00
license = licenses.gpl3Plus;
2021-10-12 10:00:56 +02:00
maintainers = with maintainers; [ nickcao ];
2021-02-05 11:14:31 +01:00
};
}