nixos-dotfiles/modules/pkgs/jellyfin-media-player.nix.save

84 lines
3.0 KiB
Plaintext
Executable File

{ lib, stdenv, fetchurl, dpkg, wrapGAppsHook, autoPatchelfHook
, alsa-lib, atk, at-spi2-atk, at-spi2-core, cairo, cups, dbus, expat, fontconfig, freetype
, gdk-pixbuf, glib, gtk3, libcxx, libdrm, libnotify, libpulseaudio, libuuid, libX11, libxcb
, libXcomposite, libXcursor, libXdamage, libXext, libXfixes, libXi, libXrandr, libXrender
, libXScrnSaver, libXtst, mesa, nspr, nss, openssl, pango, systemd, writeText, runCommandLocal, wget }:
stdenv.mkDerivation rec {
pname = "jellyfin-media-player";
version = "1.7.1";
src = runCommandLocal "${pname}_${version}_amd64-jammy.deb"
rec {
outputHashMode = "recursive";
outputHashAlgo = "sha256";
outputHash = "sha256-g2RldDAvgEpyKz+umxcaAjWfGGH9DZ56UndsIraudFg=";
nativeBuildInputs = [ wget ];
impureEnvVars = lib.fetchers.proxyImpureEnvVars;
} ''
# Figure out certificates
wget --no-check-certificate \
-U "Mozilla/5.0 (X11; Linux x86_64; rv:103.0)" \
https://github.com/jellyfin/jellyfin-media-player/releases/download/v1.7.1/jellyfin-media-player_1.7.1-1_amd64-jammy.deb \
-O $out
'';
nativeBuildInputs = [
dpkg
wrapGAppsHook
autoPatchelfHook
];
buildInputs = [
libcxx systemd libpulseaudio
stdenv.cc.cc alsa-lib atk at-spi2-atk at-spi2-core cairo cups
dbus expat fontconfig freetype gdk-pixbuf glib gtk3 libdrm libnotify
libuuid libX11 libxcb libXcomposite libXcursor libXdamage libXext libXfixes
libXi libXrandr libXrender libXScrnSaver libXtst mesa nspr nss pango systemd
];
libPath = lib.makeLibraryPath buildInputs;
dontWrapGApps = true;
dontBuild = true;
dontConfigure = true;
unpackPhase = ''
# curl -i -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:103.0) Gecko/20100101 Firefox/103.0" -O https://upwork-usw2-desktopapp.upwork.com/binaries/v5_6_10_13_3c485d1dd2af4f61/upwork_5.6.10.13_amd64.deb
echo $out
echo $src
dpkg-deb -x "$src" ./
'';
installPhase = ''
runHook preInstall
mv usr $out
# mv share $out
# Now it requires lib{ssl,crypto}.so.1.0.0. Fix based on Spotify pkg.
# https://github.com/NixOS/nixpkgs/blob/efea022d6fe0da84aa6613d4ddeafb80de713457/pkgs/applications/audio/spotify/default.nix#L129
# mkdir -p $out/lib/upwork
# ln -s ${lib.getLib openssl}/lib/libssl.so $out/lib/upwork/libssl.so.1.0.0
# ln -s ${lib.getLib openssl}/lib/libcrypto.so $out/lib/upwork/libcrypto.so.1.0.0
sed -e "s|/opt/jellyfin-media-player|$out/bin|g" -i $out/share/applications/com.github.iwalton3.jellyfin-media-player.desktop
makeWrapper $out/bin/jellyfinmediaplayer \
$out/bin/jellyfinmediaplayer \
--prefix LD_LIBRARY_PATH : ${libPath}
runHook postInstall
'';
meta = with lib; {
description = "Jellyfin Desktop Client based on Plex Media Player";
homepage = "https://github.com/jellyfin/jellyfin-media-player";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.gpl2Only;
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ seanomik ];
};
}