mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2025-01-07 22:11:45 +03:00
webtorrent_desktop: run in fhsenv
this fixes current breakage, and should be a more durable solution for running the binary distribution
This commit is contained in:
parent
e905ff84a5
commit
0cfc54bb46
@ -1,95 +1,76 @@
|
|||||||
|
## FIXME: see ../../../servers/code-server/ for a proper yarn packaging
|
||||||
|
## - export ELECTRON_SKIP_BINARY_DOWNLOAD=1
|
||||||
|
## - jq "del(.scripts.preinstall)" node_modules/shellcheck/package.json | sponge node_modules/shellcheck/package.json
|
||||||
{
|
{
|
||||||
alsa-lib, atk, cairo, cups, dbus, dpkg, expat, fetchurl, fetchzip, fontconfig, freetype,
|
lib, stdenv, buildFHSUserEnvBubblewrap, runCommand, writeScript, fetchurl, fetchzip
|
||||||
gdk-pixbuf, glib, gtk3, libX11, libXScrnSaver, libXcomposite, libXcursor,
|
|
||||||
libXdamage, libXext, libXfixes, libXi, libXrandr, libXrender, libXtst,
|
|
||||||
libxcb, nspr, nss, lib, stdenv, udev, libuuid, pango, at-spi2-atk, at-spi2-core
|
|
||||||
}:
|
}:
|
||||||
|
let
|
||||||
|
pname = "webtorrent-desktop";
|
||||||
|
version = "0.21.0";
|
||||||
|
in
|
||||||
|
runCommand "${pname}-${version}" rec {
|
||||||
|
inherit (stdenv) shell;
|
||||||
|
inherit pname version;
|
||||||
|
src =
|
||||||
|
if stdenv.hostPlatform.system == "x86_64-linux" then
|
||||||
|
fetchzip {
|
||||||
|
url = "https://github.com/webtorrent/webtorrent-desktop/releases/download/v${version}/WebTorrent-v${version}-linux.zip";
|
||||||
|
sha256 = "13gd8isq2l10kibsc1bsc15dbgpnwa7nw4cwcamycgx6pfz9a852";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw "Webtorrent is not currently supported on ${stdenv.hostPlatform.system}";
|
||||||
|
|
||||||
let
|
fhs = buildFHSUserEnvBubblewrap rec {
|
||||||
rpath = lib.makeLibraryPath ([
|
name = "fhsEnterWebTorrent";
|
||||||
alsa-lib
|
runScript = "${src}/WebTorrent";
|
||||||
atk
|
## use the trampoline, if you need to shell into the fhsenv
|
||||||
at-spi2-core
|
# runScript = writeScript "trampoline" ''
|
||||||
at-spi2-atk
|
# #!/bin/sh
|
||||||
cairo
|
# exec "$@"
|
||||||
cups
|
# '';
|
||||||
dbus
|
targetPkgs = pkgs: with pkgs; with xorg; [
|
||||||
expat
|
alsa-lib atk at-spi2-core at-spi2-atk cairo cups dbus expat
|
||||||
fontconfig
|
fontconfig freetype gdk-pixbuf glib gtk3 pango libuuid libX11
|
||||||
freetype
|
libXScrnSaver libXcomposite libXcursor libXdamage libXext
|
||||||
gdk-pixbuf
|
libXfixes libXi libXrandr libXrender libXtst libxcb nspr nss
|
||||||
glib
|
stdenv.cc.cc udev
|
||||||
gtk3
|
];
|
||||||
pango
|
# extraBwrapArgs = [
|
||||||
libuuid
|
# "--ro-bind /run/user/$(id -u)/pulse /run/user/$(id -u)/pulse"
|
||||||
libX11
|
# ];
|
||||||
libXScrnSaver
|
};
|
||||||
libXcomposite
|
|
||||||
libXcursor
|
|
||||||
libXdamage
|
|
||||||
libXext
|
|
||||||
libXfixes
|
|
||||||
libXi
|
|
||||||
libXrandr
|
|
||||||
libXrender
|
|
||||||
libXtst
|
|
||||||
libxcb
|
|
||||||
nspr
|
|
||||||
nss
|
|
||||||
stdenv.cc.cc
|
|
||||||
udev
|
|
||||||
]);
|
|
||||||
in stdenv.mkDerivation rec {
|
|
||||||
pname = "webtorrent-desktop";
|
|
||||||
version = "0.21.0";
|
|
||||||
|
|
||||||
src =
|
desktopFile = fetchurl {
|
||||||
if stdenv.hostPlatform.system == "x86_64-linux" then
|
url = "https://raw.githubusercontent.com/webtorrent/webtorrent-desktop/v${version}/static/linux/share/applications/webtorrent-desktop.desktop";
|
||||||
fetchzip {
|
sha256 = "1v16dqbxqds3cqg3xkzxsa5fyd8ssddvjhy9g3i3lz90n47916ca";
|
||||||
url = "https://github.com/webtorrent/webtorrent-desktop/releases/download/v${version}/WebTorrent-v${version}-linux.zip";
|
};
|
||||||
sha256 = "13gd8isq2l10kibsc1bsc15dbgpnwa7nw4cwcamycgx6pfz9a852";
|
icon256File = fetchurl {
|
||||||
}
|
url = "https://raw.githubusercontent.com/webtorrent/webtorrent-desktop/v${version}/static/linux/share/icons/hicolor/256x256/apps/webtorrent-desktop.png";
|
||||||
else
|
sha256 = "1dapxvvp7cx52zhyaby4bxm4rll9xc7x3wk8k0il4g3mc7zzn3yk";
|
||||||
throw "Webtorrent is not currently supported on ${stdenv.hostPlatform.system}";
|
};
|
||||||
desktopFile = fetchurl {
|
icon48File = fetchurl {
|
||||||
url = "https://raw.githubusercontent.com/webtorrent/webtorrent-desktop/v${version}/static/linux/share/applications/webtorrent-desktop.desktop";
|
url = "https://raw.githubusercontent.com/webtorrent/webtorrent-desktop/v${version}/static/linux/share/icons/hicolor/48x48/apps/webtorrent-desktop.png";
|
||||||
sha256 = "1v16dqbxqds3cqg3xkzxsa5fyd8ssddvjhy9g3i3lz90n47916ca";
|
sha256 = "00y96w9shbbrdbf6xcjlahqd08154kkrxmqraik7qshiwcqpw7p4";
|
||||||
};
|
};
|
||||||
icon256File = fetchurl {
|
|
||||||
url = "https://raw.githubusercontent.com/webtorrent/webtorrent-desktop/v${version}/static/linux/share/icons/hicolor/256x256/apps/webtorrent-desktop.png";
|
|
||||||
sha256 = "1dapxvvp7cx52zhyaby4bxm4rll9xc7x3wk8k0il4g3mc7zzn3yk";
|
|
||||||
};
|
|
||||||
icon48File = fetchurl {
|
|
||||||
url = "https://raw.githubusercontent.com/webtorrent/webtorrent-desktop/v${version}/static/linux/share/icons/hicolor/48x48/apps/webtorrent-desktop.png";
|
|
||||||
sha256 = "00y96w9shbbrdbf6xcjlahqd08154kkrxmqraik7qshiwcqpw7p4";
|
|
||||||
};
|
|
||||||
nativeBuildInputs = [ dpkg ];
|
|
||||||
installPhase = ''
|
|
||||||
mkdir -p $out/share/{applications,icons/hicolor/{48x48,256x256}/apps}
|
|
||||||
cp -R . $out/libexec
|
|
||||||
|
|
||||||
# Patch WebTorrent
|
meta = with lib; {
|
||||||
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
description = "Streaming torrent app for Mac, Windows, and Linux";
|
||||||
--set-rpath ${rpath}:$out/libexec $out/libexec/WebTorrent
|
homepage = "https://webtorrent.io/desktop";
|
||||||
|
license = licenses.mit;
|
||||||
|
maintainers = [ maintainers.flokli maintainers.bendlas ];
|
||||||
|
platforms = [
|
||||||
|
"x86_64-linux"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
# Symlink to bin
|
} ''
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/{bin,share/{applications,icons/hicolor/{48x48,256x256}/apps}}
|
||||||
ln -s $out/libexec/WebTorrent $out/bin/WebTorrent
|
|
||||||
|
|
||||||
cp $icon48File $out/share/icons/hicolor/48x48/apps/webtorrent-desktop.png
|
cp $fhs/bin/fhsEnterWebTorrent $out/bin/WebTorrent
|
||||||
cp $icon256File $out/share/icons/hicolor/256x256/apps/webtorrent-desktop.png
|
|
||||||
## Fix the desktop link
|
|
||||||
substitute $desktopFile $out/share/applications/webtorrent-desktop.desktop \
|
|
||||||
--replace /opt/webtorrent-desktop $out/libexec
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = with lib; {
|
cp $icon48File $out/share/icons/hicolor/48x48/apps/webtorrent-desktop.png
|
||||||
description = "Streaming torrent app for Mac, Windows, and Linux";
|
cp $icon256File $out/share/icons/hicolor/256x256/apps/webtorrent-desktop.png
|
||||||
homepage = "https://webtorrent.io/desktop";
|
## Fix the desktop link
|
||||||
license = licenses.mit;
|
substitute $desktopFile $out/share/applications/webtorrent-desktop.desktop \
|
||||||
maintainers = [ maintainers.flokli ];
|
--replace /opt/webtorrent-desktop $out/libexec
|
||||||
platforms = [
|
''
|
||||||
"x86_64-linux"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user