Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

mailpit: fix build by splitting off nodejs part

+33 -10
+33 -10
pkgs/servers/mail/mailpit/default.nix
··· 1 1 { lib 2 + , stdenv 2 3 , buildGoModule 3 4 , nodejs 4 5 , python3 ··· 8 9 , fetchNpmDeps 9 10 }: 10 11 11 - buildGoModule rec { 12 - pname = "mailpit"; 12 + let 13 + 13 14 version = "1.7.1"; 14 15 15 16 src = fetchFromGitHub { ··· 19 20 hash = "sha256-jT9QE0ikp9cJlT8qtfPPjKOUuqWyQk94D3UbkyaGXa8="; 20 21 }; 21 22 22 - vendorHash = "sha256-XBYIO7fdo5EahJB7EcAuY9SGKZb8dsvoJHp/D5LO5Qo="; 23 + # Separate derivation, because if we mix this in buildGoModule, the separate 24 + # go-modules build inherits specific attributes and fails. Getting that to 25 + # work is hackier than just splitting the build. 26 + ui = stdenv.mkDerivation { 27 + pname = "mailpit-ui"; 28 + inherit src version; 29 + 30 + npmDeps = fetchNpmDeps { 31 + inherit src; 32 + hash = "sha256-6VCs8125fTJkZW+eZgK56j7ccK8tcGhIXiq2HkYp4XM="; 33 + }; 34 + 35 + nativeBuildInputs = [ nodejs python3 libtool npmHooks.npmConfigHook ]; 36 + 37 + buildPhase = '' 38 + npm run package 39 + ''; 23 40 24 - npmDeps = fetchNpmDeps { 25 - inherit src; 26 - hash = "sha256-6VCs8125fTJkZW+eZgK56j7ccK8tcGhIXiq2HkYp4XM="; 41 + installPhase = '' 42 + mv server/ui/dist $out 43 + ''; 27 44 }; 28 45 29 - nativeBuildInputs = [ nodejs python3 libtool npmHooks.npmConfigHook ]; 46 + in 47 + 48 + buildGoModule { 49 + pname = "mailpit"; 50 + inherit src version; 30 51 31 - preBuild = '' 32 - npm run package 33 - ''; 52 + vendorHash = "sha256-XBYIO7fdo5EahJB7EcAuY9SGKZb8dsvoJHp/D5LO5Qo="; 34 53 35 54 CGO_ENABLED = 0; 36 55 37 56 ldflags = [ "-s" "-w" "-X github.com/axllent/mailpit/config.Version=${version}" ]; 57 + 58 + preBuild = '' 59 + cp -r ${ui} server/ui/dist 60 + ''; 38 61 39 62 meta = with lib; { 40 63 description = "An email and SMTP testing tool with API for developers";