Skip to content

Instantly share code, notes, and snippets.

@IslandUsurper
Last active August 3, 2020 13:21
Show Gist options
  • Save IslandUsurper/7874eb7b0e8d7568504402b4a6e43b01 to your computer and use it in GitHub Desktop.
Save IslandUsurper/7874eb7b0e8d7568504402b4a6e43b01 to your computer and use it in GitHub Desktop.
LBRY 0.45.1 Nix expression (WIP)
let
sources = import ./nix/sources.nix;
pkgs = import sources.nixpkgs {};
in
pkgs.stdenv.mkDerivation rec {
pname = "lbry";
version = "0.45.1";
src = pkgs.fetchurl {
url = "https://github.com/lbryio/lbry-desktop/releases/download/v${version}/LBRY_${version}.deb";
sha256 = "01qa9aqscb6y4p4i5kjn1vd6pfr08wb9062yc21nhndb9blka9pr";
};
rpath = pkgs.stdenv.lib.makeLibraryPath (with pkgs; [
libpulseaudio
libuuid
xorg.libXScrnSaver
xorg.libxcb
]) + ":${pkgs.atomEnv.libPath}";
buildInputs = with pkgs; [
ffmpeg
gtk3
];
nativeBuildInputs = with pkgs; [ dpkg makeWrapper ];
dontUnpack = true;
dontBuild = true;
dontPatchELF = true;
installPhase = ''
dpkg --fsys-tarfile $src | tar --extract
rm -rf usr/share/lintian
mkdir -p $out/bin
mv usr/* $out
mv opt/LBRY $out/
# Otherwise it looks "suspicious"
chmod -R g-w $out
for file in $(find $out -type f \( -perm /0111 -o -name \*.so\* \) ); do
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$file" || true
patchelf --set-rpath ${rpath}:$out/LBRY $file || true
done
makeWrapper $out/LBRY/lbry $out/bin/lbry \
--prefix XDG_DATA_DIRS : $GSETTINGS_SCHEMAS_PATH \
--prefix PATH : ${pkgs.xdg_utils}/bin
# Fix the desktop link
substituteInPlace $out/share/applications/lbry.desktop \
--replace /opt/LBRY/ $out/bin/
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment