about summary refs log tree commit diff
path: root/pkgs/applications/video/mpv/scripts/buildLua.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/video/mpv/scripts/buildLua.nix')
-rw-r--r--pkgs/applications/video/mpv/scripts/buildLua.nix8
1 files changed, 7 insertions, 1 deletions
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 {