about summary refs log tree commit diff stats
path: root/pkgs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--pkgs/by-name/yt/yt/package.nix31
1 files changed, 26 insertions, 5 deletions
diff --git a/pkgs/by-name/yt/yt/package.nix b/pkgs/by-name/yt/yt/package.nix
index 07a0bb3d..c6533158 100644
--- a/pkgs/by-name/yt/yt/package.nix
+++ b/pkgs/by-name/yt/yt/package.nix
@@ -16,6 +16,7 @@
   # buildInputs
   mpv-unwrapped,
   python3Packages,
+  python3,
   ffmpeg,
   openssl,
   libffi,
@@ -28,7 +29,7 @@
   pkg-config,
   SDL2,
 }: let
-  version = "1.6.0";
+  version = "1.6.1";
 in
   rustPlatform.buildRustPackage (finalAttrs: {
     inherit version;
@@ -37,7 +38,7 @@ in
     src = fetchgit {
       url = "https://git.foss-syndicate.org/bpeetz/clients/yt";
       tag = "v${version}";
-      hash = "sha256-i87xssodfVNat/YRWJRMiuNjd1R5T0NRbAzTPxWEIuo=";
+      hash = "sha256-vVmn0uPQ5t5wcrRbvabD7SOHR2hIjH2NdTE4hJaE3rk=";
     };
 
     buildInputs = [
@@ -87,9 +88,28 @@ in
       bash ./scripts/mkdb.sh
     '';
 
-    cargoHash = "sha256-MRbyWchMM1GPaWTLZt5Bgk/ry6k89woDdpQz0+mi09E=";
+    cargoHash = "sha256-6xRBXHSYUeOqRk2C5LmEwm4YLuiEjLcFDMokSMHuGXQ=";
 
-    postInstall = ''
+    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 ''
       installShellCompletion --cmd yt \
         --bash <(COMPLETE=bash $out/bin/yt) \
         --fish <(COMPLETE=fish $out/bin/yt) \
@@ -98,6 +118,7 @@ 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 YTDLP_NO_PLUGINS 1 \
+        --set PYTHONPATH ${pythonPath}
     '';
   })