From c57e205c3db36521b488db34f6f10707c7ccc82a Mon Sep 17 00:00:00 2001 From: midchildan Date: Mon, 27 Oct 2025 10:47:21 +0900 Subject: [PATCH] mpv: append yt-dlp to PATH instead of prepending it --- pkgs/applications/video/mpv/wrapper.nix | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/video/mpv/wrapper.nix b/pkgs/applications/video/mpv/wrapper.nix index bbfdab038454..35b19e24117a 100644 --- a/pkgs/applications/video/mpv/wrapper.nix +++ b/pkgs/applications/video/mpv/wrapper.nix @@ -33,13 +33,16 @@ let [ mpv.luaEnv ] - ++ lib.optionals youtubeSupport [ - yt-dlp - ] ++ lib.optionals mpv.vapoursynthSupport [ mpv.vapoursynth.python3 ] ); + + # With some tools, we want to prioritize tools that are in PATH. For example, users may want + # to quickly expose a newer version of yt-dlp through the nix shell because it needs to be + # kept up-to-date for it to work. + fallbackBinPath = lib.makeBinPath (lib.optionals youtubeSupport [ yt-dlp ]); + # All arguments besides the input and output binaries (${mpv}/bin/mpv and # $out/bin/mpv). These are used by the darwin specific makeWrapper call # used to wrap $out/Applications/mpv.app/Contents/MacOS/mpv as well. @@ -68,6 +71,12 @@ let ":" binPath ] + ++ lib.optionals (fallbackBinPath != "") [ + "--suffix" + "PATH" + ":" + fallbackBinPath + ] ++ (lib.lists.flatten ( map # For every script in the `scripts` argument, add the necessary flags to the wrapper