tangled
alpha
login
or
join now
tjh.dev
/
nixpkgs
Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
0
fork
atom
overview
issues
pulls
pipelines
mailpit: fix build by splitting off nodejs part
Stéphan Kochen
2 years ago
8a072bf4
d857b126
+33
-10
1 changed file
expand all
collapse all
unified
split
pkgs
servers
mail
mailpit
default.nix
+33
-10
pkgs/servers/mail/mailpit/default.nix
···
1
1
{ lib
2
2
+
, stdenv
2
3
, buildGoModule
3
4
, nodejs
4
5
, python3
···
8
9
, fetchNpmDeps
9
10
}:
10
11
11
11
-
buildGoModule rec {
12
12
-
pname = "mailpit";
12
12
+
let
13
13
+
13
14
version = "1.7.1";
14
15
15
16
src = fetchFromGitHub {
···
19
20
hash = "sha256-jT9QE0ikp9cJlT8qtfPPjKOUuqWyQk94D3UbkyaGXa8=";
20
21
};
21
22
22
22
-
vendorHash = "sha256-XBYIO7fdo5EahJB7EcAuY9SGKZb8dsvoJHp/D5LO5Qo=";
23
23
+
# Separate derivation, because if we mix this in buildGoModule, the separate
24
24
+
# go-modules build inherits specific attributes and fails. Getting that to
25
25
+
# work is hackier than just splitting the build.
26
26
+
ui = stdenv.mkDerivation {
27
27
+
pname = "mailpit-ui";
28
28
+
inherit src version;
29
29
+
30
30
+
npmDeps = fetchNpmDeps {
31
31
+
inherit src;
32
32
+
hash = "sha256-6VCs8125fTJkZW+eZgK56j7ccK8tcGhIXiq2HkYp4XM=";
33
33
+
};
34
34
+
35
35
+
nativeBuildInputs = [ nodejs python3 libtool npmHooks.npmConfigHook ];
36
36
+
37
37
+
buildPhase = ''
38
38
+
npm run package
39
39
+
'';
23
40
24
24
-
npmDeps = fetchNpmDeps {
25
25
-
inherit src;
26
26
-
hash = "sha256-6VCs8125fTJkZW+eZgK56j7ccK8tcGhIXiq2HkYp4XM=";
41
41
+
installPhase = ''
42
42
+
mv server/ui/dist $out
43
43
+
'';
27
44
};
28
45
29
29
-
nativeBuildInputs = [ nodejs python3 libtool npmHooks.npmConfigHook ];
46
46
+
in
47
47
+
48
48
+
buildGoModule {
49
49
+
pname = "mailpit";
50
50
+
inherit src version;
30
51
31
31
-
preBuild = ''
32
32
-
npm run package
33
33
-
'';
52
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
57
+
58
58
+
preBuild = ''
59
59
+
cp -r ${ui} server/ui/dist
60
60
+
'';
38
61
39
62
meta = with lib; {
40
63
description = "An email and SMTP testing tool with API for developers";