about summary refs log tree commit diff
path: root/pkgs/applications/video/jellyfin-media-player
diff options
context:
space:
mode:
authorJohannes Schleifenbaum <johannes@js-webcoding.de>2021-04-05 10:44:05 +0200
committerJohannes Schleifenbaum <johannes@js-webcoding.de>2021-04-14 08:22:51 +0200
commitc9997666d5de222ff084555dcaf78052754af348 (patch)
tree83b4b91785ebdd11a9b4153449e0f05a6a03f097 /pkgs/applications/video/jellyfin-media-player
parent9e9527b1b4bc632f89039be243fdd285a153cb21 (diff)
jellyfin-media-player: init at 1.3.1
Diffstat (limited to 'pkgs/applications/video/jellyfin-media-player')
-rw-r--r--pkgs/applications/video/jellyfin-media-player/default.nix108
-rw-r--r--pkgs/applications/video/jellyfin-media-player/fix-osx-resources.patch15
2 files changed, 123 insertions, 0 deletions
diff --git a/pkgs/applications/video/jellyfin-media-player/default.nix b/pkgs/applications/video/jellyfin-media-player/default.nix
new file mode 100644
index 0000000000000..bac7619c33a02
--- /dev/null
+++ b/pkgs/applications/video/jellyfin-media-player/default.nix
@@ -0,0 +1,108 @@
+{ lib
+, fetchFromGitHub
+, fetchzip
+, mkDerivation
+, stdenv
+, Cocoa
+, CoreAudio
+, CoreFoundation
+, MediaPlayer
+, SDL2
+, cmake
+, libGL
+, libX11
+, libXrandr
+, libvdpau
+, mpv
+, ninja
+, pkg-config
+, python3
+, qtbase
+, qtwayland
+, qtwebchannel
+, qtwebengine
+, qtx11extras
+}:
+
+mkDerivation rec {
+  pname = "jellyfin-media-player";
+  version = "1.3.1";
+
+  src = fetchFromGitHub {
+    owner = "iwalton3";
+    repo = "jellyfin-media-player";
+    rev = "v${version}";
+    sha256 = "sha256-rXW6vC0Ow8xFblXjGYaDExAZM8RgqLkDHiX7R8vAWjI=";
+  };
+
+  jmpDist = fetchzip {
+    url = "https://github.com/iwalton3/jellyfin-web-jmp/releases/download/jwc-10.7.2/dist.zip";
+    sha256 = "sha256-EpNAN4nzINiwMrmg0e4x3uJRTy5ovx4ZkmP83Kbn4S0=";
+  };
+
+  patches = [
+    # the webclient-files are not copied in the regular build script. Copy them just like the linux build
+    ./fix-osx-resources.patch
+  ];
+
+  buildInputs = [
+    SDL2
+    libGL
+    libX11
+    libXrandr
+    libvdpau
+    mpv
+    qtbase
+    qtwebchannel
+    qtwebengine
+    qtx11extras
+  ] ++ lib.optionals stdenv.isLinux [
+    qtwayland
+  ] ++ lib.optionals stdenv.isDarwin [
+    Cocoa
+    CoreAudio
+    CoreFoundation
+    MediaPlayer
+  ];
+
+  nativeBuildInputs = [
+    cmake
+    ninja
+    pkg-config
+    python3
+  ];
+
+  cmakeFlags = [
+    "-DCMAKE_BUILD_TYPE=Release"
+    "-DQTROOT=${qtbase}"
+    "-GNinja"
+  ];
+
+  preBuild = ''
+    # copy the webclient-files to the expected "dist" directory
+    mkdir -p dist
+    cp -a ${jmpDist}/* dist
+  '';
+
+  postInstall = lib.optionalString stdenv.isDarwin ''
+    mkdir -p $out/bin $out/Applications
+    mv "$out/Jellyfin Media Player.app" $out/Applications
+
+    # move web-client resources
+    mv $out/Resources/* "$out/Applications/Jellyfin Media Player.app/Contents/Resources/"
+    rmdir $out/Resources
+
+    # fix 'Could not find the Qt platform plugin "cocoa" in ""' error
+    wrapQtApp "$out/Applications/Jellyfin Media Player.app/Contents/MacOS/Jellyfin Media Player"
+
+    ln -s "$out/Applications/Jellyfin Media Player.app/Contents/MacOS/Jellyfin Media Player" $out/bin/jellyfinmediaplayer
+  '';
+
+  meta = with lib; {
+    homepage = "https://github.com/iwalton3/jellyfin-media-player";
+    description = "Jellyfin Desktop Client based on Plex Media Player";
+    license = with licenses; [ gpl2Plus mit ];
+    platforms = [ "x86_64-linux" "x86_64-darwin" ];
+    maintainers = with maintainers; [ jojosch ];
+  };
+}
diff --git a/pkgs/applications/video/jellyfin-media-player/fix-osx-resources.patch b/pkgs/applications/video/jellyfin-media-player/fix-osx-resources.patch
new file mode 100644
index 0000000000000..5c562295b40ea
--- /dev/null
+++ b/pkgs/applications/video/jellyfin-media-player/fix-osx-resources.patch
@@ -0,0 +1,15 @@
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 780c0d3..d9c2341 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -108,8 +108,8 @@ endif()
+ set(RESOURCE_ROOT .)
+ if(APPLE)
+   set(RESOURCE_ROOT Resources)
+-  add_resources(TARGET ${MAIN_TARGET} SOURCES ${CMAKE_CURRENT_BINARY_DIR}/../dist/ DEST ${RESOURCE_ROOT}/web-client/desktop)
+-  add_resources(TARGET ${MAIN_TARGET} SOURCES ${CMAKE_SOURCE_DIR}/native/ DEST ${RESOURCE_ROOT}/web-client/extension)
++  install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../dist/ DESTINATION ${RESOURCE_ROOT}/web-client/desktop)
++  install(DIRECTORY ${CMAKE_SOURCE_DIR}/native/ DESTINATION ${RESOURCE_ROOT}/web-client/extension)
+ endif()
+ 
+ if(NOT APPLE)