Unverified Commit a5bcb6e7 authored by Anderson Torres's avatar Anderson Torres Committed by GitHub
Browse files

Merge pull request #219909 from apfelkuchen6/mpv-uosc

mpvScripts.uosc: init at 4.6.0
parents ad075bd9 19f0a78c
Loading
Loading
Loading
Loading
+48 −0
Original line number Diff line number Diff line
{ stdenvNoCC, lib, fetchFromGitHub, makeFontsConf }:

stdenvNoCC.mkDerivation (finalAttrs: {
  pname = "uosc";
  version = "4.6.0";

  src = fetchFromGitHub {
    owner = "tomasklaen";
    repo = "uosc";
    rev = finalAttrs.version;
    hash = "sha256-AxApKlSaRLPl6VsXsARfaT3kWDK6AB2AAEmIHYiuFaM=";
  };

  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

    runHook postInstall
  '';

  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.
  passthru.extraWrapperArgs = [
    "--set"
    "FONTCONFIG_FILE"
    (toString (makeFontsConf {
      fontDirectories = [ "${finalAttrs.finalPackage}/share/fonts" ];
    }))
  ];

  meta = with lib; {
    description = "Feature-rich minimalist proximity-based UI for MPV player";
    homepage = "https://github.com/tomasklaen/uosc";
    license = licenses.gpl3Only;
    maintainers = with lib.maintainers; [ apfelkuchen6 ];
  };
})
+3 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ let
    # expected to have a `scriptName` passthru attribute that points to the
    # name of the script that would reside in the script's derivation's
    # `$out/share/mpv/scripts/`.
    # A script can optionally also provide an `extraWrapperArgs` passthru attribute.
    scripts ? [],
    extraUmpvWrapperArgs ? []
  }:
@@ -49,6 +50,8 @@ let
          # attribute of the script derivation from the `scripts`
          "--script=${script}/share/mpv/scripts/${script.scriptName}"
        ]
        # scripts can also set the `extraWrapperArgs` passthru
        ++ (script.extraWrapperArgs or [])
      ) scripts
    )) ++ extraMakeWrapperArgs)
    ;
+1 −0
Original line number Diff line number Diff line
@@ -31810,6 +31810,7 @@ with pkgs;
    simple-mpv-webui = callPackage ../applications/video/mpv/scripts/simple-mpv-webui.nix {};
    sponsorblock = callPackage ../applications/video/mpv/scripts/sponsorblock.nix {};
    thumbnail = callPackage ../applications/video/mpv/scripts/thumbnail.nix { };
    uosc = callPackage ../applications/video/mpv/scripts/uosc.nix { };
    vr-reversal = callPackage ../applications/video/mpv/scripts/vr-reversal.nix {};
    webtorrent-mpv-hook = callPackage ../applications/video/mpv/scripts/webtorrent-mpv-hook.nix { };
    youtube-quality = callPackage ../applications/video/mpv/scripts/youtube-quality.nix { };