nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 101 lines 1.9 kB view raw
1{ 2 lib, 3 stdenv, 4 buildGoModule, 5 nodejs, 6 python3, 7 libtool, 8 cctools, 9 npmHooks, 10 fetchFromGitHub, 11 fetchNpmDeps, 12 testers, 13 mailpit, 14 nixosTests, 15}: 16 17let 18 source = import ./source.nix; 19 20 inherit (source) 21 version 22 vendorHash 23 ; 24 25 src = fetchFromGitHub { 26 owner = "axllent"; 27 repo = "mailpit"; 28 rev = "v${version}"; 29 hash = source.hash; 30 }; 31 32 libtool' = if stdenv.hostPlatform.isDarwin then cctools else libtool; 33 34 # Separate derivation, because if we mix this in buildGoModule, the separate 35 # go-modules build inherits specific attributes and fails. Getting that to 36 # work is hackier than just splitting the build. 37 ui = stdenv.mkDerivation { 38 pname = "mailpit-ui"; 39 inherit src version; 40 41 npmDeps = fetchNpmDeps { 42 inherit src; 43 hash = source.npmDepsHash; 44 }; 45 46 nativeBuildInputs = [ 47 nodejs 48 python3 49 libtool' 50 npmHooks.npmConfigHook 51 ]; 52 53 buildPhase = '' 54 npm run package 55 ''; 56 57 installPhase = '' 58 mv server/ui/dist $out 59 ''; 60 }; 61 62in 63 64buildGoModule { 65 pname = "mailpit"; 66 inherit src version vendorHash; 67 68 env.CGO_ENABLED = 0; 69 70 ldflags = [ 71 "-s" 72 "-w" 73 "-X github.com/axllent/mailpit/config.Version=${version}" 74 ]; 75 76 preBuild = '' 77 cp -r ${ui} server/ui/dist 78 ''; 79 80 passthru.tests = { 81 inherit (nixosTests) mailpit; 82 version = testers.testVersion { 83 package = mailpit; 84 command = "mailpit version --no-release-check"; 85 }; 86 }; 87 88 passthru.updateScript = { 89 supportedFeatures = [ "commit" ]; 90 command = ./update.sh; 91 }; 92 93 meta = { 94 description = "Email and SMTP testing tool with API for developers"; 95 homepage = "https://github.com/axllent/mailpit"; 96 changelog = "https://github.com/axllent/mailpit/releases/tag/v${version}"; 97 maintainers = with lib.maintainers; [ stephank ]; 98 license = lib.licenses.mit; 99 mainProgram = "mailpit"; 100 }; 101}