Commit 9c2b07c6 authored by nicoo's avatar nicoo
Browse files

mpvScripts.buildLua: Infer `scriptName` from `scriptPath` over `pname`

parent 588e73db
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -8,10 +8,17 @@ let
in
lib.makeOverridable (
  { pname
  , scriptPath ? "${pname}.lua"
  , extraScripts ? []
  , ... }@args:

  let
    # 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"
    );
    scriptPath = args.scriptPath or "./${scriptName}";
  in
  stdenvNoCC.mkDerivation (lib.attrsets.recursiveUpdate {
    dontBuild = true;
    preferLocalBuild = true;
@@ -24,7 +31,7 @@ lib.makeOverridable (
      runHook postInstall
    '';

    passthru.scriptName = fileName scriptPath;
    passthru = { inherit scriptName; };
    meta.platforms = lib.platforms.all;
  } args)
)