about summary refs log tree commit diff
diff options
context:
space:
mode:
authornicoo <nicoo@mur.at>2023-11-29 13:40:21 +0000
committernicoo <nicoo@mur.at>2023-12-04 17:07:46 +0000
commitcf861f91752b0d2a81e96f22dee187eccf740f0c (patch)
treec97e75e861f9fa4e01ef80554a8bd01ade3455e0
parent492f662817bfd1191b409fb7ee09cf6af847361b (diff)
downloadnixlib-cf861f91752b0d2a81e96f22dee187eccf740f0c.tar
nixlib-cf861f91752b0d2a81e96f22dee187eccf740f0c.tar.gz
nixlib-cf861f91752b0d2a81e96f22dee187eccf740f0c.tar.bz2
nixlib-cf861f91752b0d2a81e96f22dee187eccf740f0c.tar.lz
nixlib-cf861f91752b0d2a81e96f22dee187eccf740f0c.tar.xz
nixlib-cf861f91752b0d2a81e96f22dee187eccf740f0c.tar.zst
nixlib-cf861f91752b0d2a81e96f22dee187eccf740f0c.zip
mpvScripts.uosc: 4.7.0 → 5.1.1
-rw-r--r--pkgs/applications/video/mpv/scripts/uosc.nix39
1 files changed, 27 insertions, 12 deletions
diff --git a/pkgs/applications/video/mpv/scripts/uosc.nix b/pkgs/applications/video/mpv/scripts/uosc.nix
index 311b31549ca7..4c434d49f368 100644
--- a/pkgs/applications/video/mpv/scripts/uosc.nix
+++ b/pkgs/applications/video/mpv/scripts/uosc.nix
@@ -1,35 +1,50 @@
-{ buildLua, lib, fetchFromGitHub, makeFontsConf }:
+{ 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\""
-  '';
+  tools = buildGoModule {
+    pname = "uosc-bin";
+    inherit (finalAttrs) version src;
+    vendorHash = "sha256-nkY0z2GiDxfNs98dpe+wZNI3dAXcuHaD/nHiZ2XnZ1Y=";
+  };
 
-  scriptPath = "scripts/uosc.lua";
-  postInstall = ''
-    cp -r scripts/uosc_shared $out/share/mpv/
-    cp -r fonts $out/share
-  '';
+  # 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=";
+    })
+  ];
 
   # 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; {