mpvScripts.buildLua: Strip pname when inferring scriptName

This commit is contained in:
nicoo 2023-11-11 22:27:22 +00:00
parent eab72db9b0
commit 4db7046b7f

View File

@ -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 {