nixpkgs/pkgs/by-name/ma/maddy/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

66 lines
1.6 KiB
Nix

{ lib
, stdenv
, buildGoModule
, fetchFromGitHub
, pam
, coreutils
, installShellFiles
, scdoc
, nixosTests
}:
buildGoModule rec {
pname = "maddy";
version = "0.7.1";
src = fetchFromGitHub {
owner = "foxcpp";
repo = "maddy";
rev = "v${version}";
sha256 = "sha256-jVlIjeBvxc82GQn8vW2RqcAErxZqftGj32d+IbBxQxY=";
};
vendorHash = "sha256-bSBk68w6T/Wy5klj5oC/ZW5TqDESG3mW9cIQ3auNmCk=";
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"
'';
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=strict-prototypes";
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 ];
};
}