From 595e00cbcac55249c2f27998472210b71c129227 Mon Sep 17 00:00:00 2001 From: nicoo Date: Thu, 28 Nov 2024 12:35:38 +0000 Subject: [PATCH] mpvScripts: handle nested attrsets (#359625) --- .../video/mpv/scripts/default.nix | 119 +++++++++--------- 1 file changed, 61 insertions(+), 58 deletions(-) diff --git a/pkgs/applications/video/mpv/scripts/default.nix b/pkgs/applications/video/mpv/scripts/default.nix index d11b842a83ee..5e3d3aa4e3ab 100644 --- a/pkgs/applications/video/mpv/scripts/default.nix +++ b/pkgs/applications/video/mpv/scripts/default.nix @@ -9,11 +9,13 @@ let unionOfDisjoints = lib.fold lib.attrsets.unionOfDisjoint { }; addTests = - name: drv: + attrPath: drv: if !lib.isDerivation drv then drv else let + name = lib.concatStringsSep "." attrPath; + inherit (drv) scriptName; scriptPath = "share/mpv/scripts/${scriptName}"; fullScriptPath = "${drv}/${scriptPath}"; @@ -34,7 +36,7 @@ let if [ -e "${fullScriptPath}" ]; then touch $out else - echo "mpvScripts.\"${name}\" does not contain a script named \"${scriptName}\"" >&2 + echo "mpvScripts.${name} does not contain a script named \"${scriptName}\"" >&2 exit 1 fi ''; @@ -83,62 +85,64 @@ let let inherit (self) callPackage; in - lib.mapAttrs addTests { - inherit (callPackage ./mpv.nix { }) - acompressor - autocrop - autodeint - autoload - ; - inherit (callPackage ./occivink.nix { }) - blacklistExtensions - crop - encode - seekTo - ; + lib.mapAttrsRecursiveCond (x: x.recurseForDerivations or false) addTests ( + lib.recurseIntoAttrs { + inherit (callPackage ./mpv.nix { }) + acompressor + autocrop + autodeint + autoload + ; + inherit (callPackage ./occivink.nix { }) + blacklistExtensions + crop + encode + seekTo + ; - buildLua = callPackage ./buildLua.nix { }; - autosub = callPackage ./autosub.nix { }; - autosubsync-mpv = callPackage ./autosubsync-mpv.nix { }; - chapterskip = callPackage ./chapterskip.nix { }; - convert = callPackage ./convert.nix { }; - cutter = callPackage ./cutter.nix { }; - dynamic-crop = callPackage ./dynamic-crop.nix { }; - evafast = callPackage ./evafast.nix { }; - inhibit-gnome = callPackage ./inhibit-gnome.nix { }; - memo = callPackage ./memo.nix { }; - manga-reader = callPackage ./manga-reader.nix { }; - modernx = callPackage ./modernx.nix { }; - modernx-zydezu = callPackage ./modernx-zydezu.nix { }; - mpris = callPackage ./mpris.nix { }; - mpv-cheatsheet = callPackage ./mpv-cheatsheet.nix { }; - mpv-discord = callPackage ./mpv-discord.nix { }; - mpv-notify-send = callPackage ./mpv-notify-send.nix { }; - mpv-osc-modern = callPackage ./mpv-osc-modern.nix { }; - mpv-osc-tethys = callPackage ./mpv-osc-tethys.nix { }; - mpv-playlistmanager = callPackage ./mpv-playlistmanager.nix { }; - mpv-slicing = callPackage ./mpv-slicing.nix { }; - mpv-subtitle-lines = callPackage ./mpv-subtitle-lines.nix { }; - mpv-webm = callPackage ./mpv-webm.nix { }; - mpvacious = callPackage ./mpvacious.nix { }; - quack = callPackage ./quack.nix { }; - quality-menu = callPackage ./quality-menu.nix { }; - reload = callPackage ./reload.nix { }; - simple-mpv-webui = callPackage ./simple-mpv-webui.nix { }; - smart-copy-paste-2 = callPackage ./smart-copy-paste-2.nix { }; - smartskip = callPackage ./smartskip.nix { }; - sponsorblock = callPackage ./sponsorblock.nix { }; - sponsorblock-minimal = callPackage ./sponsorblock-minimal.nix { }; - thumbfast = callPackage ./thumbfast.nix { }; - thumbnail = callPackage ./thumbnail.nix { }; - uosc = callPackage ./uosc.nix { }; - videoclip = callPackage ./videoclip.nix { }; - visualizer = callPackage ./visualizer.nix { }; - vr-reversal = callPackage ./vr-reversal.nix { }; - webtorrent-mpv-hook = callPackage ./webtorrent-mpv-hook.nix { }; - youtube-chat = callPackage ./youtube-chat.nix { }; - youtube-upnext = callPackage ./youtube-upnext.nix { }; - }; + buildLua = callPackage ./buildLua.nix { }; + autosub = callPackage ./autosub.nix { }; + autosubsync-mpv = callPackage ./autosubsync-mpv.nix { }; + chapterskip = callPackage ./chapterskip.nix { }; + convert = callPackage ./convert.nix { }; + cutter = callPackage ./cutter.nix { }; + dynamic-crop = callPackage ./dynamic-crop.nix { }; + evafast = callPackage ./evafast.nix { }; + inhibit-gnome = callPackage ./inhibit-gnome.nix { }; + memo = callPackage ./memo.nix { }; + manga-reader = callPackage ./manga-reader.nix { }; + modernx = callPackage ./modernx.nix { }; + modernx-zydezu = callPackage ./modernx-zydezu.nix { }; + mpris = callPackage ./mpris.nix { }; + mpv-cheatsheet = callPackage ./mpv-cheatsheet.nix { }; + mpv-discord = callPackage ./mpv-discord.nix { }; + mpv-notify-send = callPackage ./mpv-notify-send.nix { }; + mpv-osc-modern = callPackage ./mpv-osc-modern.nix { }; + mpv-osc-tethys = callPackage ./mpv-osc-tethys.nix { }; + mpv-playlistmanager = callPackage ./mpv-playlistmanager.nix { }; + mpv-slicing = callPackage ./mpv-slicing.nix { }; + mpv-subtitle-lines = callPackage ./mpv-subtitle-lines.nix { }; + mpv-webm = callPackage ./mpv-webm.nix { }; + mpvacious = callPackage ./mpvacious.nix { }; + quack = callPackage ./quack.nix { }; + quality-menu = callPackage ./quality-menu.nix { }; + reload = callPackage ./reload.nix { }; + simple-mpv-webui = callPackage ./simple-mpv-webui.nix { }; + smart-copy-paste-2 = callPackage ./smart-copy-paste-2.nix { }; + smartskip = callPackage ./smartskip.nix { }; + sponsorblock = callPackage ./sponsorblock.nix { }; + sponsorblock-minimal = callPackage ./sponsorblock-minimal.nix { }; + thumbfast = callPackage ./thumbfast.nix { }; + thumbnail = callPackage ./thumbnail.nix { }; + uosc = callPackage ./uosc.nix { }; + videoclip = callPackage ./videoclip.nix { }; + visualizer = callPackage ./visualizer.nix { }; + vr-reversal = callPackage ./vr-reversal.nix { }; + webtorrent-mpv-hook = callPackage ./webtorrent-mpv-hook.nix { }; + youtube-chat = callPackage ./youtube-chat.nix { }; + youtube-upnext = callPackage ./youtube-upnext.nix { }; + } + ); aliases = { youtube-quality = throw "'youtube-quality' is no longer maintained, use 'quality-menu' instead"; # added 2023-07-14 @@ -152,5 +156,4 @@ lib.pipe scope [ assert builtins.intersectAttrs self aliases == { }; self // lib.optionalAttrs config.allowAliases aliases ) - lib.recurseIntoAttrs ]