Files
nixpkgs/pkgs/by-name/ma/mailpit/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

102 lines
1.9 KiB
Nix

{
lib,
stdenv,
buildGoModule,
nodejs,
python3,
libtool,
cctools,
npmHooks,
fetchFromGitHub,
fetchNpmDeps,
testers,
mailpit,
nixosTests,
}:
let
source = import ./source.nix;
inherit (source)
version
vendorHash
;
src = fetchFromGitHub {
owner = "axllent";
repo = "mailpit";
rev = "v${version}";
hash = source.hash;
};
libtool' = if stdenv.hostPlatform.isDarwin then cctools else libtool;
# Separate derivation, because if we mix this in buildGoModule, the separate
# go-modules build inherits specific attributes and fails. Getting that to
# work is hackier than just splitting the build.
ui = stdenv.mkDerivation {
pname = "mailpit-ui";
inherit src version;
npmDeps = fetchNpmDeps {
inherit src;
hash = source.npmDepsHash;
};
nativeBuildInputs = [
nodejs
python3
libtool'
npmHooks.npmConfigHook
];
buildPhase = ''
npm run package
'';
installPhase = ''
mv server/ui/dist $out
'';
};
in
buildGoModule {
pname = "mailpit";
inherit src version vendorHash;
env.CGO_ENABLED = 0;
ldflags = [
"-s"
"-w"
"-X github.com/axllent/mailpit/config.Version=${version}"
];
preBuild = ''
cp -r ${ui} server/ui/dist
'';
passthru.tests = {
inherit (nixosTests) mailpit;
version = testers.testVersion {
package = mailpit;
command = "mailpit version --no-release-check";
};
};
passthru.updateScript = {
supportedFeatures = [ "commit" ];
command = ./update.sh;
};
meta = with lib; {
description = "Email and SMTP testing tool with API for developers";
homepage = "https://github.com/axllent/mailpit";
changelog = "https://github.com/axllent/mailpit/releases/tag/v${version}";
maintainers = with maintainers; [ stephank ];
license = licenses.mit;
mainProgram = "mailpit";
};
}