summary refs log tree commit diff
path: root/pkgs/tools/networking/persepolis/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/networking/persepolis/default.nix')
-rw-r--r--pkgs/tools/networking/persepolis/default.nix33
1 files changed, 27 insertions, 6 deletions
diff --git a/pkgs/tools/networking/persepolis/default.nix b/pkgs/tools/networking/persepolis/default.nix
index ed449ecb992..35727c13e69 100644
--- a/pkgs/tools/networking/persepolis/default.nix
+++ b/pkgs/tools/networking/persepolis/default.nix
@@ -1,5 +1,9 @@
-{ lib, buildPythonApplication, fetchFromGitHub
+{ lib
+, stdenv
+, buildPythonApplication
+, fetchFromGitHub
 , aria
+, ffmpeg
 , libnotify
 , pulseaudio
 , psutil
@@ -9,7 +13,7 @@
 , setuptools
 , sound-theme-freedesktop
 , wrapQtAppsHook
-, youtube-dl
+, yt-dlp
 }:
 
 buildPythonApplication rec {
@@ -26,10 +30,27 @@ buildPythonApplication rec {
   # see: https://github.com/persepolisdm/persepolis/blob/3.2.0/setup.py#L130
   doCheck = false;
 
-  preBuild=''
+  preBuild=
+  # Make setup automatic
+  ''
     substituteInPlace setup.py --replace "answer = input(" "answer = 'y'#"
+  '' +
+  # Replace abandoned youtube-dl with maintained fork yt-dlp. Fixes https://github.com/persepolisdm/persepolis/issues/930,
+  # can be removed if that issue is fixed and/or https://github.com/persepolisdm/persepolis/pull/936 is merged
+  ''
+    substituteInPlace setup.py ./persepolis/scripts/video_finder_addlink.py --replace \
+        "import youtube_dl" "import yt_dlp as youtube_dl"
   '';
 
+  patches = lib.optionals stdenv.isDarwin [
+    # Upstream is abandonware, the last commit to master was on 2021-08-26.
+    # If it is forked or picked up again, consider upstreaming these patches.
+    ./0001-Allow-building-on-darwin.patch
+    ./0002-Fix-startup-crash-on-darwin.patch
+    ./0003-Search-PATH-for-aria2c-on-darwin.patch
+    ./0004-Search-PATH-for-ffmpeg-on-darwin.patch
+  ];
+
   postPatch = ''
     sed -i 's|/usr/share/sounds/freedesktop/stereo/|${sound-theme-freedesktop}/share/sounds/freedesktop/stereo/|' setup.py
     sed -i "s|'persepolis = persepolis.__main__'|'persepolis = persepolis.scripts.persepolis:main'|" setup.py
@@ -46,7 +67,7 @@ buildPythonApplication rec {
 
   # feed args to wrapPythonApp
   makeWrapperArgs = [
-    "--prefix PATH : ${lib.makeBinPath [aria libnotify ]}"
+    "--prefix PATH : ${lib.makeBinPath [ aria ffmpeg libnotify ]}"
     "\${qtWrapperArgs[@]}"
   ];
 
@@ -58,13 +79,13 @@ buildPythonApplication rec {
     setproctitle
     setuptools
     sound-theme-freedesktop
-    youtube-dl
+    yt-dlp
   ];
 
   meta = with lib; {
     description = "Persepolis Download Manager is a GUI for aria2";
     homepage = "https://persepolisdm.github.io/";
     license = licenses.gpl3;
-    maintainers = [ ];
+    maintainers = with maintainers; [ iFreilicht ];
   };
 }