9c6ee729d6
GitOrigin-RevId: 6cee3b5893090b0f5f0a06b4cf42ca4e60e5d222
69 lines
1.5 KiB
Nix
69 lines
1.5 KiB
Nix
{ lib
|
|
, stdenv
|
|
, buildGoModule
|
|
, nodejs
|
|
, python3
|
|
, libtool
|
|
, npmHooks
|
|
, fetchFromGitHub
|
|
, fetchNpmDeps
|
|
}:
|
|
|
|
let
|
|
|
|
version = "1.7.1";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "axllent";
|
|
repo = "mailpit";
|
|
rev = "v${version}";
|
|
hash = "sha256-jT9QE0ikp9cJlT8qtfPPjKOUuqWyQk94D3UbkyaGXa8=";
|
|
};
|
|
|
|
# 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 = "sha256-6VCs8125fTJkZW+eZgK56j7ccK8tcGhIXiq2HkYp4XM=";
|
|
};
|
|
|
|
nativeBuildInputs = [ nodejs python3 libtool npmHooks.npmConfigHook ];
|
|
|
|
buildPhase = ''
|
|
npm run package
|
|
'';
|
|
|
|
installPhase = ''
|
|
mv server/ui/dist $out
|
|
'';
|
|
};
|
|
|
|
in
|
|
|
|
buildGoModule {
|
|
pname = "mailpit";
|
|
inherit src version;
|
|
|
|
vendorHash = "sha256-XBYIO7fdo5EahJB7EcAuY9SGKZb8dsvoJHp/D5LO5Qo=";
|
|
|
|
CGO_ENABLED = 0;
|
|
|
|
ldflags = [ "-s" "-w" "-X github.com/axllent/mailpit/config.Version=${version}" ];
|
|
|
|
preBuild = ''
|
|
cp -r ${ui} server/ui/dist
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "An 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;
|
|
};
|
|
}
|