-
Notifications
You must be signed in to change notification settings - Fork 7
/
release.nix
166 lines (165 loc) · 4.9 KB
/
release.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
{ pkgs ? import ./pkgs.nix {} }:
with pkgs;
let
utils = callPackage ./utils.nix {};
buildDeb = arch:
stdenv.mkDerivation rec {
name = "${utils.basename}-${version}-linux-${arch}.deb";
version = utils.node2nixDev.version;
src = "${utils.node2nixDev}/lib/node_modules/${utils.node2nixDev.packageName}";
buildInputs = [
nodePackages."@electron-forge/cli"
dpkg
fakeroot
];
electron_zip_dir = utils.electronZipDir;
# DEBUG = "*" # uncomment to see electron-forge debug logs
buildPhase = ''
# skip check for node, npm and git
mkdir home
touch home/.skip-forge-system-check
export HOME="$(realpath home)"
cp ${./package.json} package.json
cp ${./forge.config.js} forge.config.js
electron-forge make \
--arch ${arch} \
--platform linux \
--targets @electron-forge/maker-deb
'';
installPhase = ''
cp out/make/deb/${arch}/*.deb $out
'';
};
buildRpm = arch:
let
builtRpm = vmTools.runInLinuxVM (stdenv.mkDerivation rec {
memSize = 2048; # 2 GiB for the VM
name = "${utils.basename}-${version}-linux-${arch}.rpm";
version = utils.node2nixDev.version;
src = "${utils.node2nixDev}/lib/node_modules/${utils.node2nixDev.packageName}";
buildInputs = [
nodePackages."@electron-forge/cli"
rpm
];
electron_zip_dir = utils.electronZipDir;
# DEBUG = "*" # uncomment to see electron-forge debug logs
buildPhase = ''
# skip check for node, npm and git
mkdir home
touch home/.skip-forge-system-check
export HOME="$(realpath home)"
cp ${./package.json} package.json
cp ${./forge.config.js} forge.config.js
electron-forge make \
--arch ${arch} \
--platform linux \
--targets @electron-forge/maker-rpm
'';
installPhase = ''
cp out/make/rpm/${arch}/*.rpm $out
'';
dontFixup = true;
});
in
runCommand builtRpm.name { version = builtRpm.version; } ''
cp ${builtRpm}/* $out
'';
buildExe = arch:
stdenv.mkDerivation rec {
name = "${utils.basename}-${version}-win32-${arch}.exe";
version = utils.node2nixDev.version;
src = "${utils.node2nixDev}/lib/node_modules/${utils.node2nixDev.packageName}";
buildInputs = [
nodePackages."@electron-forge/cli"
wineWowPackages.full
mono
];
electron_zip_dir = utils.electronZipDir;
# DEBUG = "*" # uncomment to see electron-forge debug logs
buildPhase = ''
# wine needs a home
mkdir home
# skip check for node, npm and git
touch home/.skip-forge-system-check
export HOME="$(realpath home)"
cp ${./package.json} package.json
cp ${./forge.config.js} forge.config.js
electron-forge make \
--arch ${arch} \
--platform win32 \
--targets @electron-forge/maker-squirrel
'';
installPhase = ''
cp out/make/squirrel.windows/${arch}/*.exe $out
'';
};
buildZip = arch:
stdenv.mkDerivation rec {
name = "${utils.basename}-${version}-darwin-${arch}.zip";
version = utils.node2nixDev.version;
src = "${utils.node2nixDev}/lib/node_modules/${utils.node2nixDev.packageName}";
buildInputs = [
nodePackages."@electron-forge/cli"
zip
];
electron_zip_dir = utils.electronZipDir;
# DEBUG = "*" # uncomment to see electron-forge debug logs
buildPhase = ''
# skip check for node, npm and git
mkdir home
touch home/.skip-forge-system-check
export HOME="$(realpath home)"
cp ${./package.json} package.json
cp ${./forge.config.js} forge.config.js
electron-forge make \
--arch ${arch} \
--platform darwin \
--targets @electron-forge/maker-zip
'';
installPhase = ''
cp out/make/zip/darwin/${arch}/*.zip $out
'';
};
in
rec {
application = callPackage ./default.nix {};
docker = dockerTools.buildImage {
name = application.name;
contents = [ application ];
keepContentsDirlinks = true;
extraCommands = ''
mkdir -m 1777 tmp
'';
config = {
Cmd = [ "/bin/${utils.basename}" ];
};
};
package = {
linux = {
x64 = {
deb = buildDeb "x64";
rpm = buildRpm "x64";
};
ia32 = {
deb = buildDeb "ia32";
rpm = buildRpm "ia32";
};
};
windows = {
x64 = {
exe = buildExe "x64";
};
ia32 = {
exe = buildExe "ia32";
};
};
darwin = {
x64 = {
zip = buildZip "x64";
};
arm64 = {
zip = buildZip "arm64";
};
};
};
}