2023-07-15 17:15:38 +00:00
|
|
|
{ lib
|
|
|
|
, config
|
2024-01-02 11:29:13 +00:00
|
|
|
, newScope
|
|
|
|
, runCommand
|
2023-07-15 17:15:38 +00:00
|
|
|
}:
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
let
|
|
|
|
unionOfDisjoints = lib.fold lib.attrsets.unionOfDisjoint {};
|
|
|
|
|
|
|
|
addTests = name: drv:
|
|
|
|
if ! lib.isDerivation drv then
|
|
|
|
drv
|
|
|
|
else let
|
|
|
|
inherit (drv) scriptName;
|
|
|
|
scriptPath = "share/mpv/scripts/${scriptName}";
|
|
|
|
fullScriptPath = "${drv}/${scriptPath}";
|
|
|
|
in drv.overrideAttrs (old: { passthru = (old.passthru or {}) // { tests = unionOfDisjoints [
|
|
|
|
(old.passthru.tests or {})
|
|
|
|
|
|
|
|
{
|
|
|
|
scriptName-is-valid = runCommand "mpvScripts.${name}.passthru.tests.scriptName-is-valid" {
|
|
|
|
meta.maintainers = with lib.maintainers; [ nicoo ];
|
|
|
|
preferLocalBuild = true;
|
|
|
|
} ''
|
|
|
|
if [ -e "${fullScriptPath}" ]; then
|
|
|
|
touch $out
|
|
|
|
else
|
|
|
|
echo "mpvScripts.\"${name}\" does not contain a script named \"${scriptName}\"" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
}
|
|
|
|
|
|
|
|
# can't check whether `fullScriptPath` is a directory, in pure-evaluation mode
|
|
|
|
(with lib; optionalAttrs (! any (s: hasSuffix s drv.passthru.scriptName) [ ".js" ".lua" ".so" ]) {
|
|
|
|
single-main-in-script-dir = runCommand "mpvScripts.${name}.passthru.tests.single-main-in-script-dir" {
|
|
|
|
meta.maintainers = with lib.maintainers; [ nicoo ];
|
|
|
|
preferLocalBuild = true;
|
|
|
|
} ''
|
|
|
|
die() {
|
|
|
|
echo "$@" >&2
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
cd "${drv}/${scriptPath}" # so the glob expands to filenames only
|
|
|
|
mains=( main.* )
|
|
|
|
if [ "''${#mains[*]}" -eq 1 ]; then
|
|
|
|
touch $out
|
|
|
|
elif [ "''${#mains[*]}" -eq 0 ]; then
|
|
|
|
die "'${scriptPath}' contains no 'main.*' file"
|
|
|
|
else
|
|
|
|
die "'${scriptPath}' contains multiple 'main.*' files:" "''${mains[*]}"
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
})
|
|
|
|
]; }; });
|
|
|
|
|
|
|
|
scope = self: let
|
|
|
|
inherit (self) callPackage;
|
|
|
|
in lib.mapAttrs addTests {
|
|
|
|
inherit (callPackage ./mpv.nix { })
|
|
|
|
acompressor autocrop autodeint autoload;
|
|
|
|
inherit (callPackage ./occivink.nix { })
|
|
|
|
blacklistExtensions seekTo;
|
|
|
|
|
|
|
|
buildLua = callPackage ./buildLua.nix { };
|
|
|
|
chapterskip = callPackage ./chapterskip.nix { };
|
|
|
|
convert = callPackage ./convert.nix { };
|
|
|
|
cutter = callPackage ./cutter.nix { };
|
2023-07-15 17:15:38 +00:00
|
|
|
inhibit-gnome = callPackage ./inhibit-gnome.nix { };
|
|
|
|
mpris = callPackage ./mpris.nix { };
|
2024-01-02 11:29:13 +00:00
|
|
|
mpv-playlistmanager = callPackage ./mpv-playlistmanager.nix { };
|
2023-10-09 19:29:22 +00:00
|
|
|
mpv-webm = callPackage ./mpv-webm.nix { };
|
2023-07-15 17:15:38 +00:00
|
|
|
mpvacious = callPackage ./mpvacious.nix { };
|
2024-01-02 11:29:13 +00:00
|
|
|
quality-menu = callPackage ./quality-menu.nix { };
|
2023-07-15 17:15:38 +00:00
|
|
|
simple-mpv-webui = callPackage ./simple-mpv-webui.nix { };
|
|
|
|
sponsorblock = callPackage ./sponsorblock.nix { };
|
2024-01-02 11:29:13 +00:00
|
|
|
sponsorblock-minimal = callPackage ./sponsorblock-minimal.nix { };
|
2023-07-15 17:15:38 +00:00
|
|
|
thumbfast = callPackage ./thumbfast.nix { };
|
2024-01-02 11:29:13 +00:00
|
|
|
thumbnail = callPackage ./thumbnail.nix { };
|
2023-07-15 17:15:38 +00:00
|
|
|
uosc = callPackage ./uosc.nix { };
|
2023-08-10 07:59:29 +00:00
|
|
|
visualizer = callPackage ./visualizer.nix { };
|
2023-07-15 17:15:38 +00:00
|
|
|
vr-reversal = callPackage ./vr-reversal.nix { };
|
|
|
|
webtorrent-mpv-hook = callPackage ./webtorrent-mpv-hook.nix { };
|
2024-01-02 11:29:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
aliases = {
|
|
|
|
youtube-quality = throw "'youtube-quality' is no longer maintained, use 'quality-menu' instead"; # added 2023-07-14
|
|
|
|
};
|
|
|
|
in
|
|
|
|
|
|
|
|
with lib; pipe scope [
|
|
|
|
(makeScope newScope)
|
|
|
|
(self:
|
|
|
|
assert builtins.intersectAttrs self aliases == {};
|
|
|
|
self // optionalAttrs config.allowAliases aliases)
|
|
|
|
recurseIntoAttrs
|
|
|
|
]
|