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

80 lines
1.8 KiB
Nix

{ lib
, pkgs
, stdenv
, fetchurl
# Packaging tools
, dpkg
, wrapQtAppsHook
# Dependencies
, qtbase
, qt5
, xorg
, mesa
, SDL2
, zlib-ng
, fribidi
, gnutls
, libcec
, mpv
}:
stdenv.mkDerivation rec {
version = "1.7.1";
hotfix = "-1";
pname = "jellyfin-media-player";
src = fetchurl {
url = "https://github.com/jellyfin/jellyfin-media-player/releases/download/v${version}/jellyfin-media-player_${version}${hotfix}_amd64-jammy.deb";
sha256 = "sha256-9z3L0c+2LDPMx82biJq/Mhsb8rt6Lr+4F/jWzT5v0R4=";
};
sourceRoot = ".";
unpackCmd = "dpkg-deb -x $src .";
dontConfigure = true;
dontBuild = true;
nativeBuildInputs = [ wrapQtAppsHook dpkg ];
buildInputs = [ qtbase qt5.qtwebengine ];
installPhase = ''
# Copy everything in usr to $out
cp -r usr/ $out/
# Link the web-client next to the bin file.
# Without this, the qt5-webengine(?) wont load since it can't find .html files
ln -s $out/share/jellyfinmediaplayer/web-client $out/bin/web-client
'';
preFixup = let
libPath = lib.makeLibraryPath [
qtbase
qt5.qtwebengine qt5.qtquickcontrols qt5.qtx11extras qt5.qtwebchannel qt5.qtdeclarative
xorg.libX11 # libX11.so.6
xorg.libXrandr # libXrandr.so.2
SDL2 # libSDL2-2.0.so.0
libcec # libcec.so.6
mpv # libmpv.so.1
stdenv.cc.cc.lib # libstdc++.so.6
];
in ''
patchelf \
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath "${libPath}" \
$out/bin/jellyfinmediaplayer
'';
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.gpl2;
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ seanomik ];
};
}