From e994574e925cb0e9b4887001992f758544896375 Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Tue, 27 Jun 2023 08:07:07 +0200 Subject: [PATCH] mpv: add test "mpv-scripts-should-not-collide" --- pkgs/applications/video/mpv/wrapper.nix | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pkgs/applications/video/mpv/wrapper.nix b/pkgs/applications/video/mpv/wrapper.nix index 0dd735071f00..b427318121ef 100644 --- a/pkgs/applications/video/mpv/wrapper.nix +++ b/pkgs/applications/video/mpv/wrapper.nix @@ -1,8 +1,11 @@ # Arguments that this derivation gets when it is created with `callPackage` { stdenv +, buildEnv , lib , makeWrapper +, mpvScripts , symlinkJoin +, writeTextDir , yt-dlp }: @@ -71,6 +74,20 @@ let passthru.unwrapped = mpv; + passthru.tests.mpv-scripts-should-not-collide = buildEnv { + name = "mpv-scripts-env"; + paths = lib.pipe mpvScripts [ + # filters "override" "overrideDerivation" "recurseForDerivations" + (lib.filterAttrs (key: script: lib.isDerivation script)) + # replaces unfree and meta.broken scripts with decent placeholders + (lib.mapAttrsToList (key: script: + if (builtins.tryEval script.outPath).success + then script + else writeTextDir "share/mpv/scripts/${script.scriptName}" "placeholder of ${script.name}" + )) + ]; + }; + postBuild = '' # wrapProgram can't operate on symlinks rm "$out/bin/mpv"