about summary refs log tree commit diff stats
path: root/pkgs/by-name/yt/yt/package.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/yt/yt/package.nix')
-rw-r--r--pkgs/by-name/yt/yt/package.nix62
1 files changed, 30 insertions, 32 deletions
diff --git a/pkgs/by-name/yt/yt/package.nix b/pkgs/by-name/yt/yt/package.nix
index ce30f7cc..2c34a0bb 100644
--- a/pkgs/by-name/yt/yt/package.nix
+++ b/pkgs/by-name/yt/yt/package.nix
@@ -15,12 +15,14 @@
   gitUpdater,
   # buildInputs
   mpv-unwrapped,
-  python3Packages,
-  python3,
-  ffmpeg,
+  ffmpeg-headless,
   openssl,
   libffi,
+  zlib,
+  curl,
+  deno,
   # NativeBuildInputs
+  python3,
   makeWrapper,
   llvmPackages_latest,
   glibc,
@@ -30,7 +32,8 @@
   pkg-config,
   SDL2,
 }: let
-  version = "1.7.0";
+  version = "1.9.0";
+  python = python3.withPackages (ps: [ps.yt-dlp]);
 in
   rustPlatform.buildRustPackage (finalAttrs: {
     inherit version;
@@ -39,15 +42,20 @@ in
     src = fetchgit {
       url = "https://git.foss-syndicate.org/bpeetz/clients/yt";
       tag = "v${version}";
-      hash = "sha256-7PWGXucGBsn3IuainNZ23IW5t19SyEATwqGxYgZGqrw=";
+      hash = "sha256-/Isgqe7Hda/1kwYY+ciQH/NBAcWvM92vDxWZ9svlQAM=";
     };
 
+    cargoHash = "sha256-U0alYK9mhz6esVf0mad9o7Ra6tRaL9HKCOftyOg34HE=";
+
     buildInputs = [
-      python3Packages.yt-dlp
       mpv-unwrapped.dev
-      ffmpeg
+      ffmpeg-headless
       openssl
       libffi
+      zlib
+      curl.dev
+      python
+      deno
     ];
 
     nativeBuildInputs = [
@@ -75,7 +83,10 @@ in
       DATABASE_URL = "sqlite://database.sqlx";
 
       # Required by yt_dlp
-      FFMPEG_LOCATION = "${lib.getExe ffmpeg}";
+      FFMPEG_LOCATION = "${lib.getExe ffmpeg-headless}";
+
+      # Tell pyo3 which python to use.
+      PYO3_PYTHON = lib.getExe python;
 
       # Needed for the libmpv2.
       C_INCLUDE_PATH = "${glibc.dev}/include";
@@ -84,34 +95,22 @@ in
     };
 
     doCheck = true;
+    checkFlags = [
+      # All of these tests try to connect to the internet to download test data.
+      "--skip=select::base::test_base"
+      "--skip=select::file::test_file"
+      "--skip=select::options::test_options"
+      "--skip=subscriptions::import_export::test_import_export"
+      "--skip=subscriptions::naming_subscriptions::test_naming_subscriptions"
+      "--skip=videos::downloading::test_downloading"
+    ];
 
     prePatch = ''
       # Generate the sqlite db, so that we can run the comp-time sqlite checks.
       bash ./scripts/mkdb.sh
     '';
 
-    cargoHash = "sha256-5c2VKjYj8pFHx+aLgGcnqbegIhJia6vB73cwuYjs7Sg=";
-
-    postInstall = let
-      collectDeps = pkg: let
-        next = pkg.propagatedBuildInputs or [];
-      in
-        [pkg]
-        ++ next
-        ++ (lib.flatten (builtins.map collectDeps next));
-
-      loadPythonDep = der: "${der}/lib/python${lib.versions.majorMinor python3.version}/site-packages";
-
-      pythonPath = builtins.concatStringsSep ":" (lib.lists.unique (
-        builtins.map loadPythonDep (
-          (collectDeps python3Packages.yt-dlp)
-          ++ [
-            # HACK(@bpeetz): These packages are not picked up in the traversal up top. <2025-06-16>
-            python3Packages.chardet
-          ]
-        )
-      ));
-    in ''
+    postInstall = ''
       installShellCompletion --cmd yt \
         --bash <(COMPLETE=bash $out/bin/yt) \
         --fish <(COMPLETE=fish $out/bin/yt) \
@@ -120,7 +119,6 @@ in
       # NOTE: We cannot clear the path, because we need access to the $EDITOR. <2025-04-04>
       wrapProgram $out/bin/yt \
         --prefix PATH : ${lib.makeBinPath finalAttrs.buildInputs} \
-        --set YTDLP_NO_PLUGINS 1 \
-        --set PYTHONPATH ${pythonPath}
+        --set YTDLP_NO_PLUGINS 1
     '';
   })