tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
ride: refactor and improve electron usage
TomaSajt
1 year ago
e05db846
91bbd392
+55
-44
2 changed files
expand all
collapse all
unified
split
pkgs
by-name
ri
ride
mk.patch
package.nix
+35
-8
pkgs/by-name/ri/ride/mk.patch
···
1
1
diff --git a/mk b/mk
2
2
-
index a5baa0f8..37cac28e 100755
2
2
+
index a5baa0f..4ed2350 100644
3
3
--- a/mk
4
4
+++ b/mk
5
5
@@ -25,7 +25,7 @@ const rm = (x) => {
···
22
22
},
23
23
};
24
24
wf('_/version.js', `D=${JSON.stringify(vi)}`);
25
25
-
@@ -50,6 +50,9 @@ const incl = new RegExp('^$'
26
26
-
+ '|^/style($|/(fonts|img)|.*\\.css$)');
25
25
+
@@ -51,8 +51,7 @@ const incl = new RegExp('^$'
27
26
const pkg = (x, y, f) => {
28
27
rq('electron-packager')({
28
28
+
dir: '.',
29
29
+
- platform: x,
30
30
+
- arch: y,
29
31
+ asar: true,
30
30
-
+ electronZipDir: "local-cache",
31
31
-
+ electronVersion: "@electron_version@",
32
32
-
dir: '.',
33
33
-
platform: x,
34
34
-
arch: y,
32
32
+
tmpdir: '/tmp/ridebuild',
33
33
+
out: `_/${pj.name}`,
34
34
+
overwrite: true,
35
35
+
@@ -79,8 +78,8 @@ const pkg = (x, y, f) => {
36
36
+
ProductName: 'RIDE',
37
37
+
InternalName: 'RIDE',
38
38
+
},
39
39
+
- }).then(() => {
40
40
+
- const d = `_/${pj.name}/${pj.productName}-${x}-${y}`;
41
41
+
+ }).then(paths => {
42
42
+
+ const d = paths[0];
43
43
+
rm(`${d}/version`);
44
44
+
fs.existsSync(`${d}/LICENSE`) && mv(`${d}/LICENSE`, `${d}/LICENSE.electron`);
45
45
+
generateLicenses(`${d}/ThirdPartyNotices.txt`);
46
46
+
@@ -88,6 +87,7 @@ const pkg = (x, y, f) => {
47
47
+
}, e => f(e));
48
48
+
};
49
49
+
50
50
+
+const self = (f) => { b(e => (e ? f(e) : pkg(undefined, undefined, f))); };
51
51
+
const l = (f) => { b(e => (e ? f(e) : pkg('linux', 'x64', f))); };
52
52
+
const w = (f) => { b(e => (e ? f(e) : pkg('win32', 'ia32', f))); };
53
53
+
const o = (f) => { b(e => (e ? f(e) : pkg('darwin', 'x64', f))); };
54
54
+
@@ -109,6 +109,7 @@ tasks.ma=ma; tasks.masarm = ma;
55
55
+
tasks.a = a; tasks.arm = a;
56
56
+
tasks.d = d; tasks.dist = d;
57
57
+
tasks.c = c; tasks.clean = c;
58
58
+
+tasks.self = self;
59
59
+
60
60
+
async.each(
61
61
+
process.argv.length > 2 ? process.argv.slice(2) : ['build'],
+20
-36
pkgs/by-name/ri/ride/package.nix
···
4
4
buildNpmPackage,
5
5
fetchFromGitHub,
6
6
fetchpatch,
7
7
-
substituteAll,
7
7
+
replaceVars,
8
8
jq,
9
9
moreutils,
10
10
zip,
···
15
15
cctools,
16
16
}:
17
17
18
18
-
let
19
19
-
platformInfos = {
20
20
-
"x86_64-linux" = {
21
21
-
zipSuffix = "linux-x64";
22
22
-
buildCmd = "linux";
23
23
-
};
24
24
-
"x86_64-darwin" = {
25
25
-
zipSuffix = "darwin-x64";
26
26
-
buildCmd = "osx";
27
27
-
};
28
28
-
"aarch64-darwin" = {
29
29
-
zipSuffix = "darwin-arm64";
30
30
-
buildCmd = "osxarm";
31
31
-
};
32
32
-
};
33
33
-
34
34
-
platformInfo = platformInfos.${stdenv.system};
35
35
-
in
36
18
buildNpmPackage rec {
37
19
pname = "ride";
38
20
version = "4.5.4097";
···
40
22
src = fetchFromGitHub {
41
23
owner = "Dyalog";
42
24
repo = "ride";
43
43
-
rev = "v${version}";
25
25
+
rev = "refs/tags/v${version}";
44
26
hash = "sha256-xR+HVC1JVrPkgPhIJZxdTVG52+QbanmD1c/uO5l84oc=";
45
27
};
46
28
···
53
35
url = "https://github.com/Dyalog/ride/commit/de42ebbd5036cfe0c7e6604296e87cc57ac9d365.patch";
54
36
hash = "sha256-5iKSNcxOOo2fKNvy3Rv+AlH3psYhLWLWUY0l8M6mAD4=";
55
37
})
56
56
-
# Fix info in the "about" page, set electron version, set local-cache as zipdir
57
57
-
(substituteAll {
58
58
-
src = ./mk.patch;
59
59
-
version = version;
60
60
-
electron_version = electron.version;
38
38
+
39
39
+
# Fix info in the "about" page, enable asar, add option to build for the detected system
40
40
+
(replaceVars ./mk.patch {
41
41
+
inherit version;
61
42
})
62
43
];
63
44
···
89
70
zip
90
71
makeWrapper
91
72
]
92
92
-
++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ copyDesktopItems ]
73
73
+
++ lib.optionals stdenv.hostPlatform.isLinux [ copyDesktopItems ]
93
74
++ lib.optionals stdenv.hostPlatform.isDarwin [ cctools ];
94
75
95
76
env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
···
99
80
stdenv.hostPlatform.isDarwin && lib.versionOlder stdenv.hostPlatform.darwinSdkVersion "11.0"
100
81
) "-D_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION=1";
101
82
102
102
-
npmBuildFlags = platformInfo.buildCmd;
83
83
+
# our patch adds the platform detecting build option
84
84
+
npmBuildFlags = "self";
103
85
104
104
-
# This package uses electron-packager instead of electron-builder
105
105
-
# Here, we create a local cache of electron zip-files, so electron-packager can copy from it
106
86
postConfigure = ''
107
107
-
mkdir local-cache
108
108
-
109
87
# electron files need to be writable on Darwin
110
88
cp -r ${electron.dist} electron-dist
111
89
chmod -R u+w electron-dist
112
90
113
91
pushd electron-dist
114
114
-
zip -qr ../local-cache/electron-v${electron.version}-${platformInfo.zipSuffix}.zip *
92
92
+
zip -0Xqr ../electron.zip *
115
93
popd
94
94
+
95
95
+
rm -r electron-dist
96
96
+
97
97
+
# force electron-packager to use our electron instead of downloading it, even if it is a different version
98
98
+
substituteInPlace node_modules/electron-packager/src/index.js \
99
99
+
--replace-fail 'await this.getElectronZipPath(downloadOpts)' '"electron.zip"'
116
100
'';
117
101
118
102
installPhase = ''
···
122
106
123
107
install -Dm644 ThirdPartyNotices.txt -t $out/share/doc/ride
124
108
125
125
-
${lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
109
109
+
${lib.optionalString stdenv.hostPlatform.isLinux ''
126
110
install -Dm644 $src/D.png $out/share/icons/hicolor/64x64/apps/ride.png
127
111
install -Dm644 $src/D.svg $out/share/icons/hicolor/scalable/apps/ride.svg
128
112
129
113
mkdir -p $out/share/ride
130
114
cp -r locales resources{,.pak} $out/share/ride
131
131
-
makeWrapper ${lib.getExe electron} $out/bin/ride \
115
115
+
makeShellWrapper ${lib.getExe electron} $out/bin/ride \
132
116
--add-flags $out/share/ride/resources/app.asar \
133
117
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
134
118
--inherit-argv0
···
161
145
];
162
146
163
147
meta = {
164
164
-
changelog = "https://github.com/Dyalog/ride/releases/tag/${src.rev}";
148
148
+
changelog = "https://github.com/Dyalog/ride/releases/tag/v${version}";
165
149
description = "Remote IDE for Dyalog APL";
166
150
homepage = "https://github.com/Dyalog/ride";
167
151
license = lib.licenses.mit;
···
170
154
tomasajt
171
155
markus1189
172
156
];
173
173
-
platforms = lib.attrNames platformInfos;
157
157
+
platforms = electron.meta.platforms;
174
158
};
175
159
}