diff options
author | nicoo <nicoo@mur.at> | 2023-11-11 21:32:48 +0000 |
---|---|---|
committer | nicoo <nicoo@mur.at> | 2023-11-11 22:43:48 +0000 |
commit | 588e73db432c2b6a1932033232733da0078a5251 (patch) | |
tree | 3c877fb3611e5509187c6f4594194f30d9107d16 /pkgs/applications/video/mpv | |
parent | e8c0fde6b3826780ee2832afbc4c72373cb87af1 (diff) | |
download | nixlib-588e73db432c2b6a1932033232733da0078a5251.tar nixlib-588e73db432c2b6a1932033232733da0078a5251.tar.gz nixlib-588e73db432c2b6a1932033232733da0078a5251.tar.bz2 nixlib-588e73db432c2b6a1932033232733da0078a5251.tar.lz nixlib-588e73db432c2b6a1932033232733da0078a5251.tar.xz nixlib-588e73db432c2b6a1932033232733da0078a5251.tar.zst nixlib-588e73db432c2b6a1932033232733da0078a5251.zip |
mpvScripts.buildLua: Only accept plain `scriptPath`, no glob etc.
This makes future support for directory-packaged scripts much easier. An `extraScripts` parameter is provided for packaging scripts which expect multiple files (or folders) in `mpv/scripts/`, even though this does not comply with mpv's documented script location: https://mpv.io/manual/master/#script-location
Diffstat (limited to 'pkgs/applications/video/mpv')
-rw-r--r-- | pkgs/applications/video/mpv/scripts/buildLua.nix | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/pkgs/applications/video/mpv/scripts/buildLua.nix b/pkgs/applications/video/mpv/scripts/buildLua.nix index b86642305fc6..f00b35254efe 100644 --- a/pkgs/applications/video/mpv/scripts/buildLua.nix +++ b/pkgs/applications/video/mpv/scripts/buildLua.nix @@ -1,10 +1,17 @@ { lib , stdenvNoCC }: -let fileName = pathStr: lib.last (lib.splitString "/" pathStr); +let + escapedList = with lib; concatMapStringsSep " " (s: "'${escape [ "'" ] s}'"); + fileName = pathStr: lib.last (lib.splitString "/" pathStr); + scriptsDir = "$out/share/mpv/scripts"; in lib.makeOverridable ( - { pname, scriptPath ? "${pname}.lua", ... }@args: + { pname + , scriptPath ? "${pname}.lua" + , extraScripts ? [] + , ... }@args: + stdenvNoCC.mkDerivation (lib.attrsets.recursiveUpdate { dontBuild = true; preferLocalBuild = true; @@ -12,7 +19,8 @@ lib.makeOverridable ( outputHashMode = "recursive"; installPhase = '' runHook preInstall - install -m644 -Dt $out/share/mpv/scripts ${scriptPath} + install -m644 -Dt "${scriptsDir}" \ + ${escapedList ([ scriptPath ] ++ extraScripts)} runHook postInstall ''; |