about summary refs log tree commit diff
path: root/pkgs/applications/video/mpv
diff options
context:
space:
mode:
authornicoo <nicoo@mur.at>2023-11-29 12:47:14 +0000
committernicoo <nicoo@mur.at>2023-12-04 17:07:45 +0000
commitce2dcc6dcb6bdbb6c1be5799ac14aa4874a8739c (patch)
treec90ad7595e0cda6681b4b2fb90092cc0674041aa /pkgs/applications/video/mpv
parent6444a0957bd825e454382d5e7211865afe8ab534 (diff)
downloadnixlib-ce2dcc6dcb6bdbb6c1be5799ac14aa4874a8739c.tar
nixlib-ce2dcc6dcb6bdbb6c1be5799ac14aa4874a8739c.tar.gz
nixlib-ce2dcc6dcb6bdbb6c1be5799ac14aa4874a8739c.tar.bz2
nixlib-ce2dcc6dcb6bdbb6c1be5799ac14aa4874a8739c.tar.lz
nixlib-ce2dcc6dcb6bdbb6c1be5799ac14aa4874a8739c.tar.xz
nixlib-ce2dcc6dcb6bdbb6c1be5799ac14aa4874a8739c.tar.zst
nixlib-ce2dcc6dcb6bdbb6c1be5799ac14aa4874a8739c.zip
mpvScripts.buildLua: Handle explicitly-recursive attrsets
No rebuild needed, so this did not change existing uses of `buildLua`.
Diffstat (limited to 'pkgs/applications/video/mpv')
-rw-r--r--pkgs/applications/video/mpv/scripts/buildLua.nix17
1 files changed, 12 insertions, 5 deletions
diff --git a/pkgs/applications/video/mpv/scripts/buildLua.nix b/pkgs/applications/video/mpv/scripts/buildLua.nix
index 728cb1c41556..4c1e1957c097 100644
--- a/pkgs/applications/video/mpv/scripts/buildLua.nix
+++ b/pkgs/applications/video/mpv/scripts/buildLua.nix
@@ -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)
-)
+  })
+))