diff options
author | Maciej Krüger <mkg20001@gmail.com> | 2023-12-09 22:19:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-09 22:19:44 +0100 |
commit | 81d9c2772e095b0d55c8c8823d26abbbae643d80 (patch) | |
tree | 47823ffc7174c9c8904d8ede5b3dbb6cd27e6355 /pkgs/applications/video | |
parent | d4999df27090afd1dfca354328878767ee97337c (diff) | |
parent | cf861f91752b0d2a81e96f22dee187eccf740f0c (diff) | |
download | nixlib-81d9c2772e095b0d55c8c8823d26abbbae643d80.tar nixlib-81d9c2772e095b0d55c8c8823d26abbbae643d80.tar.gz nixlib-81d9c2772e095b0d55c8c8823d26abbbae643d80.tar.bz2 nixlib-81d9c2772e095b0d55c8c8823d26abbbae643d80.tar.lz nixlib-81d9c2772e095b0d55c8c8823d26abbbae643d80.tar.xz nixlib-81d9c2772e095b0d55c8c8823d26abbbae643d80.tar.zst nixlib-81d9c2772e095b0d55c8c8823d26abbbae643d80.zip |
Merge pull request #270962 from nbraud/mpvScripts/uosc
mpvScripts.uosc: 4.7.0 → 5.1.1
Diffstat (limited to 'pkgs/applications/video')
-rw-r--r-- | pkgs/applications/video/mpv/scripts/buildLua.nix | 30 | ||||
-rw-r--r-- | pkgs/applications/video/mpv/scripts/default.nix | 2 | ||||
-rw-r--r-- | pkgs/applications/video/mpv/scripts/uosc.nix | 50 |
3 files changed, 44 insertions, 38 deletions
diff --git a/pkgs/applications/video/mpv/scripts/buildLua.nix b/pkgs/applications/video/mpv/scripts/buildLua.nix index 046b0fa2ea96..4c1e1957c097 100644 --- a/pkgs/applications/video/mpv/scripts/buildLua.nix +++ b/pkgs/applications/video/mpv/scripts/buildLua.nix @@ -5,31 +5,29 @@ let inherit (lib) hasPrefix hasSuffix removeSuffix; escapedList = with lib; concatMapStringsSep " " (s: "'${escape [ "'" ] s}'"); fileName = pathStr: lib.last (lib.splitString "/" pathStr); - nameFromPath = pathStr: - let fN = fileName pathStr; in - if hasSuffix ".lua" fN then - fN - else if !(hasPrefix "." fN) then - "${fN}.lua" - else - null - ; 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: let # either passthru.scriptName, inferred from scriptPath, or from pname scriptName = (args.passthru or {}).scriptName or ( - if args ? scriptPath && nameFromPath args.scriptPath != null - then nameFromPath args.scriptPath + if args ? scriptPath + then fileName args.scriptPath else "${pname}.lua" ); scriptPath = args.scriptPath or "./${scriptName}"; - in - stdenvNoCC.mkDerivation (lib.attrsets.recursiveUpdate { + in { dontBuild = true; preferLocalBuild = true; @@ -59,5 +57,5 @@ lib.makeOverridable ( passthru = { inherit scriptName; }; meta.platforms = lib.platforms.all; - } args) -) + }) +)) diff --git a/pkgs/applications/video/mpv/scripts/default.nix b/pkgs/applications/video/mpv/scripts/default.nix index fb75464ab98e..4083c52b3d90 100644 --- a/pkgs/applications/video/mpv/scripts/default.nix +++ b/pkgs/applications/video/mpv/scripts/default.nix @@ -22,7 +22,7 @@ in lib.recurseIntoAttrs sponsorblock = callPackage ./sponsorblock.nix { }; thumbfast = callPackage ./thumbfast.nix { inherit buildLua; }; thumbnail = callPackage ./thumbnail.nix { inherit buildLua; }; - uosc = callPackage ./uosc.nix { }; + uosc = callPackage ./uosc.nix { inherit buildLua; }; visualizer = callPackage ./visualizer.nix { }; vr-reversal = callPackage ./vr-reversal.nix { }; webtorrent-mpv-hook = callPackage ./webtorrent-mpv-hook.nix { }; diff --git a/pkgs/applications/video/mpv/scripts/uosc.nix b/pkgs/applications/video/mpv/scripts/uosc.nix index b88cd2c5b968..4c434d49f368 100644 --- a/pkgs/applications/video/mpv/scripts/uosc.nix +++ b/pkgs/applications/video/mpv/scripts/uosc.nix @@ -1,42 +1,50 @@ -{ stdenvNoCC, lib, fetchFromGitHub, makeFontsConf }: - -stdenvNoCC.mkDerivation (finalAttrs: { +{ lib +, fetchFromGitHub +, fetchpatch +, makeFontsConf +, buildLua +, buildGoModule +}: + +buildLua (finalAttrs: { pname = "uosc"; - version = "4.7.0"; + version = "5.1.1"; + scriptPath = "src/uosc"; src = fetchFromGitHub { owner = "tomasklaen"; repo = "uosc"; rev = finalAttrs.version; - hash = "sha256-JqlBjhwRgmXl6XfHYTwtNWZj656EDHjcdWOlCgihF5I="; + hash = "sha256-+4k8T1yX3IRXK3XkUShsuJSH9w1Zla7CaRENcIqX4iM="; }; - postPatch = '' - substituteInPlace scripts/uosc.lua \ - --replace "mp.find_config_file('scripts')" "\"$out/share/mpv/scripts\"" - ''; - - dontBuild = true; - - installPhase = '' - runHook preInstall - - mkdir -p $out/share/mpv/ - cp -r scripts $out/share/mpv - cp -r fonts $out/share + tools = buildGoModule { + pname = "uosc-bin"; + inherit (finalAttrs) version src; + vendorHash = "sha256-nkY0z2GiDxfNs98dpe+wZNI3dAXcuHaD/nHiZ2XnZ1Y="; + }; - runHook postInstall - ''; + # Patch lua script to get the path to its `ziggy` binary form the environment + patches = [ + # uosc#814: Support overriding `ziggy_path` via environment variable + (fetchpatch { + url = "https://github.com/tomasklaen/uosc/commit/4fdf68a1bcb510824d66f35ecc7672a6452a44b2.patch"; + hash = "sha256-igUqFf8e7LVIIjGxACdIWAeZxjF/yqaCL4QRXrzNQXk="; + }) + ]; - passthru.scriptName = "uosc.lua"; # the script uses custom "texture" fonts as the background for ui elements. # In order for mpv to find them, we need to adjust the fontconfig search path. + postInstall = "cp -r src/fonts $out/share"; passthru.extraWrapperArgs = [ "--set" "FONTCONFIG_FILE" (toString (makeFontsConf { fontDirectories = [ "${finalAttrs.finalPackage}/share/fonts" ]; })) + "--set" + "MPV_UOSC_ZIGGY" + (lib.getExe' finalAttrs.tools "ziggy") ]; meta = with lib; { |