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