From 70e05cb799e96e86c741e7496ec17b6b9c6b066e Mon Sep 17 00:00:00 2001 From: Nicky Mouha Date: Sun, 9 Nov 2025 10:15:20 -0500 Subject: [PATCH 1/2] yt-dlp: fix impersonation with curl-cffi --- pkgs/by-name/yt/yt-dlp/package.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkgs/by-name/yt/yt-dlp/package.nix b/pkgs/by-name/yt/yt-dlp/package.nix index a54f623a3b51..d2a373f2ac08 100644 --- a/pkgs/by-name/yt/yt-dlp/package.nix +++ b/pkgs/by-name/yt/yt-dlp/package.nix @@ -32,6 +32,10 @@ python3Packages.buildPythonApplication rec { postPatch = '' substituteInPlace yt_dlp/version.py \ --replace-fail "UPDATE_HINT = None" 'UPDATE_HINT = "Nixpkgs/NixOS likely already contain an updated version.\n To get it run nix-channel --update or nix flake update in your config directory."' + # Until yt-dlp supports curl-cffi 0.14.x, this patch is needed: + substituteInPlace yt_dlp/networking/_curlcffi.py \ + --replace-fail "if curl_cffi_version != (0, 5, 10) and not (0, 10) <= curl_cffi_version < (0, 14)" \ + "if curl_cffi_version != (0, 5, 10) and not (0, 10) <= curl_cffi_version" ''; build-system = with python3Packages; [ hatchling ]; @@ -98,6 +102,14 @@ python3Packages.buildPythonApplication rec { doCheck = false; postInstall = '' + # Check for "unsupported" string in yt-dlp -v output. + output=$($out/bin/yt-dlp -v 2>&1 || true) + if echo $output | grep -q "unsupported"; then + echo "ERROR: Found \"unsupported\" string in yt-dlp -v output." + exit 1 + fi + '' + + '' installManPage yt-dlp.1 installShellCompletion \ From d2862efc9e9391af4151a5aed5b8629880150632 Mon Sep 17 00:00:00 2001 From: Nicky Mouha Date: Mon, 10 Nov 2025 19:44:36 -0500 Subject: [PATCH 2/2] yt-dlp: add checkPhase to detect unsupported library --- pkgs/by-name/yt/yt-dlp/package.nix | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/pkgs/by-name/yt/yt-dlp/package.nix b/pkgs/by-name/yt/yt-dlp/package.nix index d2a373f2ac08..15d8ec8ac8e8 100644 --- a/pkgs/by-name/yt/yt-dlp/package.nix +++ b/pkgs/by-name/yt/yt-dlp/package.nix @@ -98,18 +98,16 @@ python3Packages.buildPythonApplication rec { ''--prefix PATH : "${lib.makeBinPath packagesToBinPath}"'' ]; - # Requires network - doCheck = false; - - postInstall = '' + checkPhase = '' # Check for "unsupported" string in yt-dlp -v output. output=$($out/bin/yt-dlp -v 2>&1 || true) if echo $output | grep -q "unsupported"; then echo "ERROR: Found \"unsupported\" string in yt-dlp -v output." exit 1 fi - '' - + '' + ''; + + postInstall = '' installManPage yt-dlp.1 installShellCompletion \