mpvScripts.buildLua: Handle explicitly-recursive attrsets

No rebuild needed, so this did not change existing uses of `buildLua`.
This commit is contained in:
nicoo
2023-12-04 17:07:45 +00:00
parent 6444a0957b
commit ce2dcc6dcb
@@ -6,8 +6,16 @@ let
escapedList = with lib; concatMapStringsSep " " (s: "'${escape [ "'" ] s}'");
fileName = pathStr: lib.last (lib.splitString "/" pathStr);
scriptsDir = "$out/share/mpv/scripts";
# similar to `lib.extends`, but with inverted precedence and recursive update
extendedBy = args: orig: self:
let super = args self;
in lib.recursiveUpdate (orig super) super
;
in
lib.makeOverridable (
lib.makeOverridable (args: stdenvNoCC.mkDerivation (extendedBy
(if lib.isFunction args then args else (_: args)) (
{ pname
, extraScripts ? []
, ... }@args:
@@ -19,8 +27,7 @@ lib.makeOverridable (
else "${pname}.lua"
);
scriptPath = args.scriptPath or "./${scriptName}";
in
stdenvNoCC.mkDerivation (lib.attrsets.recursiveUpdate {
in {
dontBuild = true;
preferLocalBuild = true;
@@ -50,5 +57,5 @@ lib.makeOverridable (
passthru = { inherit scriptName; };
meta.platforms = lib.platforms.all;
} args)
)
})
))