From e4bb290195c57c5b43d17df3c66ddd611825ec95 Mon Sep 17 00:00:00 2001 From: WheelsForReals Date: Wed, 12 Nov 2025 19:22:09 -0600 Subject: [PATCH] mpv: update wrapper to support multiple `--script` args --- .../video/mpv/scripts/mpv-osc-tethys.nix | 1 + .../video/mpv/scripts/quality-menu.nix | 1 + .../video/mpv/scripts/thumbnail.nix | 2 +- pkgs/applications/video/mpv/wrapper.nix | 17 +++++++++++------ 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/pkgs/applications/video/mpv/scripts/mpv-osc-tethys.nix b/pkgs/applications/video/mpv/scripts/mpv-osc-tethys.nix index eff4397616f9..fe8908ba09d3 100644 --- a/pkgs/applications/video/mpv/scripts/mpv-osc-tethys.nix +++ b/pkgs/applications/video/mpv/scripts/mpv-osc-tethys.nix @@ -9,6 +9,7 @@ buildLua (finalAttrs: { scriptPath = "osc_tethys.lua"; extraScriptsToCopy = [ "mpv_thumbnail_script_server.lua" ]; + extraScriptsToLoad = [ "mpv_thumbnail_script_server.lua" ]; src = fetchFromGitHub { owner = "Zren"; diff --git a/pkgs/applications/video/mpv/scripts/quality-menu.nix b/pkgs/applications/video/mpv/scripts/quality-menu.nix index e910cf1a9984..f08c383e6559 100644 --- a/pkgs/applications/video/mpv/scripts/quality-menu.nix +++ b/pkgs/applications/video/mpv/scripts/quality-menu.nix @@ -19,6 +19,7 @@ buildLua rec { passthru.updateScript = gitUpdater { rev-prefix = "v"; }; extraScriptsToCopy = lib.optional oscSupport "quality-menu-osc.lua"; + extraScriptsToLoad = lib.optional oscSupport "quality-menu-osc.lua"; meta = with lib; { description = "Userscript for MPV that allows you to change youtube video quality (ytdl-format) on the fly"; diff --git a/pkgs/applications/video/mpv/scripts/thumbnail.nix b/pkgs/applications/video/mpv/scripts/thumbnail.nix index 414fb67cb073..c84cb6f95a67 100644 --- a/pkgs/applications/video/mpv/scripts/thumbnail.nix +++ b/pkgs/applications/video/mpv/scripts/thumbnail.nix @@ -24,7 +24,7 @@ buildLua rec { scriptPath = "mpv_thumbnail_script_client_osc.lua"; extraScriptsToCopy = [ "mpv_thumbnail_script_server.lua" ]; - passthru.scriptName = "mpv_thumbnail_script_{client_osc,server}.lua"; + extraScriptsToLoad = [ "mpv_thumbnail_script_server.lua" ]; meta = { description = "Lua script to show preview thumbnails in mpv's OSC seekbar"; diff --git a/pkgs/applications/video/mpv/wrapper.nix b/pkgs/applications/video/mpv/wrapper.nix index bbfdab038454..ed3dfbbb88f2 100644 --- a/pkgs/applications/video/mpv/wrapper.nix +++ b/pkgs/applications/video/mpv/wrapper.nix @@ -73,12 +73,17 @@ let # For every script in the `scripts` argument, add the necessary flags to the wrapper ( script: - [ - "--add-flags" - # Here we rely on the existence of the `scriptName` passthru - # attribute of the script derivation from the `scripts` - "--script=${script}/share/mpv/scripts/${script.scriptName}" - ] + let + mkScriptArgs = script: scriptName: [ + "--add-flags" + "--script=${script}/share/mpv/scripts/${scriptName}" + ]; + in + # Here we rely on the existence of the `scriptName` passthru + # attribute of the script derivation from the `scripts` + (mkScriptArgs script script.scriptName) + # scripts might need others to be explicitly loaded + ++ (map (extraScriptName: mkScriptArgs script extraScriptName) (script.extraScriptsToLoad or [ ])) # scripts can also set the `extraWrapperArgs` passthru ++ (script.extraWrapperArgs or [ ]) )