From 3d86a2b28836acacffaad6edb6461ea42cce39e7 Mon Sep 17 00:00:00 2001 From: Danilo Reyes Date: Sat, 20 Dec 2025 17:47:22 -0600 Subject: [PATCH] stream-dl fixed? --- flake.nix | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index bc6ad79..7116eb2 100644 --- a/flake.nix +++ b/flake.nix @@ -39,10 +39,52 @@ }; }; download = _final.python3Packages.download; + # Fix curl-impersonate-ff build issue with CMake 4.0+ requiring CMake >= 3.5 + curl-impersonate-ff = prev.curl-impersonate-ff.overrideAttrs (oldAttrs: { + postPatch = (oldAttrs.postPatch or "") + '' + # Fix brotli CMake build by adding CMAKE_POLICY_VERSION_MINIMUM flag + substituteInPlace Makefile.in \ + --replace 'cmake -DCMAKE_BUILD_TYPE=Release' 'cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_BUILD_TYPE=Release' + ''; + }); + # Also fix curl-impersonate if it has the same issue + curl-impersonate = prev.curl-impersonate.overrideAttrs (oldAttrs: { + postPatch = (oldAttrs.postPatch or "") + '' + # Fix brotli CMake build by adding CMAKE_POLICY_VERSION_MINIMUM flag + substituteInPlace Makefile.in \ + --replace 'cmake -DCMAKE_BUILD_TYPE=Release' 'cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_BUILD_TYPE=Release' + ''; + }); }; packages.x86_64-linux = let - scriptBin = path: name: pkgs.writeScriptBin name (builtins.readFile path); + # Handle nix-shell shebangs by extracting packages and using writeShellApplication + scriptBin = path: name: + let + content = builtins.readFile path; + # Match the nix-shell package line: #! nix-shell -i bash -p package1 package2 ... + nixShellMatch = builtins.match ".*#! nix-shell -i [^ ]+ -p ([^\n]+).*" content; + in + if nixShellMatch != null then + let + packagesStr = builtins.head nixShellMatch; + # Split by spaces and filter empty strings + packages = builtins.filter (s: s != "") (pkgs.lib.splitString " " packagesStr); + # Get package references from pkgs + runtimeInputs = builtins.map (pkgName: pkgs.${pkgName}) packages; + # Remove the nix-shell shebang lines + scriptContent = builtins.replaceStrings + [ "#!/usr/bin/env nix-shell\n" "#! nix-shell -i bash -p ${packagesStr}\n" ] + [ "" "" ] + content; + in + pkgs.writeShellApplication { + inherit name; + runtimeInputs = runtimeInputs; + text = scriptContent; + } + else + pkgs.writeScriptBin name content; pkgsBin = path: _name: let