1 { lib, stdenv, electron, buildNpmPackage, fetchFromGitHub, fetchpatch }:
4 pname = "webtorrent-desktop";
5 version = "0.25-pre-ac7f16";
6 src = fetchFromGitHub {
8 repo = "webtorrent-desktop";
9 rev = "ac7f16e71c96c5ad670bfcb8728df5af78ae21a1";
10 sha256 = "sha256-UEN5NhLVSQEO8rsiTW1hJPjNFL9KobW/Bho98FzKaf4=";
15 name = "2389.patch"; # https://github.com/webtorrent/webtorrent-desktop/pull/2389
16 url = "https://github.com/webtorrent/webtorrent-desktop/commit/407046d150ed7ff876a5e1978f68630e9c8f0074.patch";
17 hash = "sha256-hBJGLNNjcGRhYOFlLm/RL0po+70tEeJtR6Y/CfacPAI=";
20 npmDepsHash = "sha256-otAes6GkqoAVvfeWhWgyY4IVZIZxw3WtkrVdEWIk1Lk=";
21 makeCacheWritable = true;
22 npmRebuildFlags = [ "--ignore-scripts" ];
24 ## Rebuild node_modules for production
25 ## after babel compile has finished
27 export NODE_ENV=production
28 npm ci --ignore-scripts
30 ## delete unused files
33 ## delete config for build time cache
34 npm config delete cache
36 ## add script wrapper and desktop files; icons
37 mkdir -p $out/lib $out/bin $out/share/applications
38 cp -r . $out/lib/webtorrent-desktop
39 cat > $out/bin/WebTorrent <<EOF
42 exec ${electron}/bin/electron --no-sandbox $out/lib/webtorrent-desktop "\$@"
44 chmod +x $out/bin/WebTorrent
45 cp -r static/linux/share/icons $out/share/
46 sed "s#/opt/webtorrent-desktop#$out/bin#" \
47 < static/linux/share/applications/webtorrent-desktop.desktop \
48 > $out/share/applications/webtorrent-desktop.desktop
52 description = "Streaming torrent app for Mac, Windows, and Linux";
53 homepage = "https://webtorrent.io/desktop";
54 license = licenses.mit;
55 maintainers = [ maintainers.bendlas ];
56 mainProgram = "WebTorrent";