mpv: update wrapper to support multiple --script args (#461114)
This commit is contained in:
@@ -23,7 +23,7 @@ lib.makeOverridable (
|
||||
extendedBy (if lib.isFunction args then args else (_: args)) (
|
||||
{
|
||||
pname,
|
||||
extraScripts ? [ ],
|
||||
extraScriptsToCopy ? [ ],
|
||||
runtime-dependencies ? [ ],
|
||||
...
|
||||
}@args:
|
||||
@@ -59,8 +59,8 @@ lib.makeOverridable (
|
||||
echo "Script directory '${scriptPath}' does not contain 'main.lua'" >&2
|
||||
exit 1
|
||||
}
|
||||
[ ${with builtins; toString (length extraScripts)} -eq 0 ] || {
|
||||
echo "mpvScripts.buildLua does not support 'extraScripts'" \
|
||||
[ ${with builtins; toString (length extraScriptsToCopy)} -eq 0 ] || {
|
||||
echo "mpvScripts.buildLua does not support 'extraScriptsToCopy'" \
|
||||
"when 'scriptPath' is a directory" >&2
|
||||
exit 1
|
||||
}
|
||||
@@ -69,8 +69,8 @@ lib.makeOverridable (
|
||||
else
|
||||
install -m644 -Dt "${scriptsDir}" ${escaped scriptPath}
|
||||
${lib.optionalString (
|
||||
extraScripts != [ ]
|
||||
) ''cp -at "${scriptsDir}/" ${escapedList extraScripts}''}
|
||||
extraScriptsToCopy != [ ]
|
||||
) ''cp -at "${scriptsDir}/" ${escapedList extraScriptsToCopy}''}
|
||||
fi
|
||||
|
||||
runHook postInstall
|
||||
|
||||
@@ -32,7 +32,7 @@ buildLua {
|
||||
'';
|
||||
|
||||
passthru.scriptName = "cutter.lua";
|
||||
extraScripts = [ "c_concat.sh" ];
|
||||
extraScriptsToCopy = [ "c_concat.sh" ];
|
||||
|
||||
postInstall = ''
|
||||
wrapProgram $out/share/mpv/scripts/c_concat.sh \
|
||||
|
||||
@@ -8,7 +8,8 @@ buildLua (finalAttrs: {
|
||||
version = "0-unstable-2024-08-19";
|
||||
|
||||
scriptPath = "osc_tethys.lua";
|
||||
extraScripts = [ "mpv_thumbnail_script_server.lua" ];
|
||||
extraScriptsToCopy = [ "mpv_thumbnail_script_server.lua" ];
|
||||
extraScriptsToLoad = [ "mpv_thumbnail_script_server.lua" ];
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "Zren";
|
||||
|
||||
@@ -18,7 +18,8 @@ buildLua rec {
|
||||
};
|
||||
passthru.updateScript = gitUpdater { rev-prefix = "v"; };
|
||||
|
||||
extraScripts = lib.optional oscSupport "quality-menu-osc.lua";
|
||||
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";
|
||||
|
||||
@@ -39,7 +39,7 @@ buildLua {
|
||||
--replace-fail 'mp.find_config_file("scripts")' "\"$out/share/mpv/scripts\""
|
||||
'';
|
||||
|
||||
extraScripts = [ "sponsorblock_shared" ];
|
||||
extraScriptsToCopy = [ "sponsorblock_shared" ];
|
||||
|
||||
passthru.updateScript = nix-update-script { extraArgs = [ "--version=branch" ]; };
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ buildLua rec {
|
||||
dontBuild = false;
|
||||
|
||||
scriptPath = "mpv_thumbnail_script_client_osc.lua";
|
||||
extraScripts = [ "mpv_thumbnail_script_server.lua" ];
|
||||
passthru.scriptName = "mpv_thumbnail_script_{client_osc,server}.lua";
|
||||
extraScriptsToCopy = [ "mpv_thumbnail_script_server.lua" ];
|
||||
extraScriptsToLoad = [ "mpv_thumbnail_script_server.lua" ];
|
||||
|
||||
meta = {
|
||||
description = "Lua script to show preview thumbnails in mpv's OSC seekbar";
|
||||
|
||||
@@ -82,12 +82,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 [ ])
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user