From 4db7046b7f8accc66c81ec9f454cb8695532a31f Mon Sep 17 00:00:00 2001 From: nicoo Date: Sat, 11 Nov 2023 22:27:22 +0000 Subject: [PATCH] mpvScripts.buildLua: Strip `pname` when inferring `scriptName` --- pkgs/applications/video/mpv/scripts/buildLua.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/video/mpv/scripts/buildLua.nix b/pkgs/applications/video/mpv/scripts/buildLua.nix index 4c1e1957c097..c7f510253f94 100644 --- a/pkgs/applications/video/mpv/scripts/buildLua.nix +++ b/pkgs/applications/video/mpv/scripts/buildLua.nix @@ -20,11 +20,17 @@ lib.makeOverridable (args: stdenvNoCC.mkDerivation (extendedBy , extraScripts ? [] , ... }@args: let + strippedName = with builtins; + let groups = match "mpv[-_](.*)" pname; in + if groups != null + then head groups + else pname + ; # either passthru.scriptName, inferred from scriptPath, or from pname scriptName = (args.passthru or {}).scriptName or ( if args ? scriptPath then fileName args.scriptPath - else "${pname}.lua" + else "${strippedName}.lua" ); scriptPath = args.scriptPath or "./${scriptName}"; in {