evcc: 0.131.4 -> 0.131.5
[NixPkgs.git] / pkgs / by-name / ma / maddy / package.nix
blobb8f3000904c232f9fa1e12364650bb447ed76d04
1 { lib
2 , stdenv
3 , buildGoModule
4 , fetchFromGitHub
5 , pam
6 , coreutils
7 , installShellFiles
8 , scdoc
9 , nixosTests
12 buildGoModule rec {
13   pname = "maddy";
14   version = "0.7.1";
16   src = fetchFromGitHub {
17     owner = "foxcpp";
18     repo = "maddy";
19     rev = "v${version}";
20     sha256 = "sha256-jVlIjeBvxc82GQn8vW2RqcAErxZqftGj32d+IbBxQxY=";
21   };
23   vendorHash = "sha256-bSBk68w6T/Wy5klj5oC/ZW5TqDESG3mW9cIQ3auNmCk=";
25   tags = [ "libpam" ];
27   ldflags = [ "-s" "-w" "-X github.com/foxcpp/maddy.Version=${version}" ];
29   subPackages = [ "cmd/maddy" ];
31   buildInputs = [ pam ];
33   nativeBuildInputs = [ installShellFiles scdoc ];
35   postInstall = ''
36     for f in docs/man/*.scd; do
37       local page="docs/man/$(basename "$f" .scd)"
38       scdoc < "$f" > "$page"
39       installManPage "$page"
40     done
42     ln -s "$out/bin/maddy" "$out/bin/maddyctl"
44     mkdir -p $out/lib/systemd/system
46     substitute dist/systemd/maddy.service $out/lib/systemd/system/maddy.service \
47       --replace "/usr/local/bin/maddy" "$out/bin/maddy" \
48       --replace "/bin/kill" "${coreutils}/bin/kill"
50     substitute dist/systemd/maddy@.service $out/lib/systemd/system/maddy@.service \
51       --replace "/usr/local/bin/maddy" "$out/bin/maddy" \
52       --replace "/bin/kill" "${coreutils}/bin/kill"
53   '';
55   env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=strict-prototypes";
57   passthru.tests.nixos = nixosTests.maddy;
59   meta = with lib; {
60     description = "Composable all-in-one mail server";
61     homepage = "https://maddy.email";
62     license = licenses.gpl3Plus;
63     maintainers = with maintainers; [ nickcao ];
64   };