diff options
Diffstat (limited to 'pkgs/applications/video/mpv')
-rw-r--r-- | pkgs/applications/video/mpv/default.nix | 13 | ||||
-rw-r--r-- | pkgs/applications/video/mpv/scripts/acompressor.nix | 22 | ||||
-rw-r--r-- | pkgs/applications/video/mpv/scripts/buildLua.nix | 22 | ||||
-rw-r--r-- | pkgs/applications/video/mpv/scripts/chapterskip.nix | 20 | ||||
-rw-r--r-- | pkgs/applications/video/mpv/scripts/convert.nix | 12 | ||||
-rw-r--r-- | pkgs/applications/video/mpv/scripts/default.nix | 16 | ||||
-rw-r--r-- | pkgs/applications/video/mpv/scripts/mpv-playlistmanager.nix | 15 | ||||
-rw-r--r-- | pkgs/applications/video/mpv/scripts/occivink.nix | 36 | ||||
-rw-r--r-- | pkgs/applications/video/mpv/scripts/quality-menu.nix | 21 | ||||
-rw-r--r-- | pkgs/applications/video/mpv/scripts/thumbfast.nix | 2 | ||||
-rw-r--r-- | pkgs/applications/video/mpv/scripts/thumbnail.nix | 23 | ||||
-rw-r--r-- | pkgs/applications/video/mpv/wrapper.nix | 2 |
12 files changed, 101 insertions, 103 deletions
diff --git a/pkgs/applications/video/mpv/default.nix b/pkgs/applications/video/mpv/default.nix index 057b9874162..33fb4fc7821 100644 --- a/pkgs/applications/video/mpv/default.nix +++ b/pkgs/applications/video/mpv/default.nix @@ -9,7 +9,7 @@ , ninja , pkg-config , python3 -, ffmpeg_5 +, ffmpeg , freefont_ttf , freetype , libass @@ -19,6 +19,7 @@ , libuchardet , libiconv , xcbuild +, sigtool , waylandSupport ? stdenv.isLinux , wayland @@ -154,12 +155,12 @@ in stdenv'.mkDerivation (finalAttrs: { pkg-config python3 ] - ++ lib.optionals stdenv.isDarwin [ xcbuild.xcrun ] + ++ lib.optionals stdenv.isDarwin [ xcbuild.xcrun sigtool ] ++ lib.optionals swiftSupport [ swift ] ++ lib.optionals waylandSupport [ wayland-scanner ]; buildInputs = [ - ffmpeg_5 + ffmpeg freetype libass libpthreadstubs @@ -203,6 +204,11 @@ in stdenv'.mkDerivation (finalAttrs: { postBuild = lib.optionalString stdenv.isDarwin '' pushd .. # Must be run from the source dir because it uses relative paths python3 TOOLS/osxbundle.py -s build/mpv + # Swap binary and bundle symlink to sign bundle executable as symlinks cannot be signed + rm build/mpv.app/Contents/MacOS/mpv-bundle + mv build/mpv.app/Contents/MacOS/mpv build/mpv.app/Contents/MacOS/mpv-bundle + ln -s mpv-bundle build/mpv.app/Contents/MacOS/mpv + codesign --force --sign - build/mpv.app/Contents/MacOS/mpv-bundle popd ''; @@ -250,6 +256,7 @@ in stdenv'.mkDerivation (finalAttrs: { ''; changelog = "https://github.com/mpv-player/mpv/releases/tag/v${finalAttrs.version}"; license = licenses.gpl2Plus; + mainProgram = "mpv"; maintainers = with maintainers; [ AndersonTorres fpletz globin ma27 tadeokondrak ]; platforms = platforms.unix; }; diff --git a/pkgs/applications/video/mpv/scripts/acompressor.nix b/pkgs/applications/video/mpv/scripts/acompressor.nix index d10ef5f9df7..d82d12f163e 100644 --- a/pkgs/applications/video/mpv/scripts/acompressor.nix +++ b/pkgs/applications/video/mpv/scripts/acompressor.nix @@ -1,27 +1,17 @@ -{ stdenvNoCC +{ lib +, buildLua , mpv-unwrapped -, lib }: -stdenvNoCC.mkDerivation rec { +buildLua { + inherit (mpv-unwrapped) src version; pname = "mpv-acompressor"; - version = mpv-unwrapped.version; - - src = "${mpv-unwrapped.src.outPath}/TOOLS/lua/acompressor.lua"; - - dontBuild = true; - dontUnpack = true; - - installPhase = '' - install -Dm644 ${src} $out/share/mpv/scripts/acompressor.lua - ''; - - passthru.scriptName = "acompressor.lua"; + scriptPath = "TOOLS/lua/acompressor.lua"; meta = with lib; { + inherit (mpv-unwrapped.meta) license; description = "Script to toggle and control ffmpeg's dynamic range compression filter."; homepage = "https://github.com/mpv-player/mpv/blob/master/TOOLS/lua/acompressor.lua"; - license = licenses.gpl2Plus; maintainers = with maintainers; [ nicoo ]; }; } diff --git a/pkgs/applications/video/mpv/scripts/buildLua.nix b/pkgs/applications/video/mpv/scripts/buildLua.nix new file mode 100644 index 00000000000..b86642305fc --- /dev/null +++ b/pkgs/applications/video/mpv/scripts/buildLua.nix @@ -0,0 +1,22 @@ +{ lib +, stdenvNoCC }: + +let fileName = pathStr: lib.last (lib.splitString "/" pathStr); +in +lib.makeOverridable ( + { pname, scriptPath ? "${pname}.lua", ... }@args: + stdenvNoCC.mkDerivation (lib.attrsets.recursiveUpdate { + dontBuild = true; + preferLocalBuild = true; + + outputHashMode = "recursive"; + installPhase = '' + runHook preInstall + install -m644 -Dt $out/share/mpv/scripts ${scriptPath} + runHook postInstall + ''; + + passthru.scriptName = fileName scriptPath; + meta.platforms = lib.platforms.all; + } args) +) diff --git a/pkgs/applications/video/mpv/scripts/chapterskip.nix b/pkgs/applications/video/mpv/scripts/chapterskip.nix new file mode 100644 index 00000000000..bffc27bd1ea --- /dev/null +++ b/pkgs/applications/video/mpv/scripts/chapterskip.nix @@ -0,0 +1,20 @@ +{ lib +, fetchFromGitHub +, buildLua }: + +buildLua { + pname = "chapterskip"; + + version = "unstable-2022-09-08"; + src = fetchFromGitHub { + owner = "po5"; + repo = "chapterskip"; + rev = "b26825316e3329882206ae78dc903ebc4613f039"; + hash = "sha256-OTrLQE3rYvPQamEX23D6HttNjx3vafWdTMxTiWpDy90="; + }; + + meta = { + homepage = "https://github.com/po5/chapterskip"; + maintainers = with lib.maintainers; [ nicoo ]; + }; +} diff --git a/pkgs/applications/video/mpv/scripts/convert.nix b/pkgs/applications/video/mpv/scripts/convert.nix index 40a1050cd32..4f90b0c62ed 100644 --- a/pkgs/applications/video/mpv/scripts/convert.nix +++ b/pkgs/applications/video/mpv/scripts/convert.nix @@ -1,7 +1,7 @@ -{ stdenvNoCC, fetchgit, lib +{ lib, fetchgit, buildLua , yad, mkvtoolnix-cli, libnotify }: -stdenvNoCC.mkDerivation { +buildLua { pname = "mpv-convert-script"; version = "2016-03-18"; src = fetchgit { @@ -22,15 +22,9 @@ stdenvNoCC.mkDerivation { 'yad_exe = "${yad}/bin/yad"' \ --replace 'notify_send_exe = "notify-send"' \ 'notify_send_exe = "${libnotify}/bin/notify-send"' \ - ''; - dontBuild = true; - installPhase = '' - mkdir -p $out/share/mpv/scripts - cp convert_script.lua $out/share/mpv/scripts - ''; - passthru.scriptName = "convert_script.lua"; + scriptPath = "convert_script.lua"; meta = with lib; { description = "Convert parts of a video while you are watching it in mpv"; diff --git a/pkgs/applications/video/mpv/scripts/default.nix b/pkgs/applications/video/mpv/scripts/default.nix index 8b928e7085b..cdc641043f3 100644 --- a/pkgs/applications/video/mpv/scripts/default.nix +++ b/pkgs/applications/video/mpv/scripts/default.nix @@ -3,30 +3,32 @@ , config }: -lib.recurseIntoAttrs +let buildLua = callPackage ./buildLua.nix { }; +in lib.recurseIntoAttrs ({ - acompressor = callPackage ./acompressor.nix { }; + acompressor = callPackage ./acompressor.nix { inherit buildLua; }; autocrop = callPackage ./autocrop.nix { }; autodeint = callPackage ./autodeint.nix { }; autoload = callPackage ./autoload.nix { }; - convert = callPackage ./convert.nix { }; + chapterskip = callPackage ./chapterskip.nix { inherit buildLua; }; + convert = callPackage ./convert.nix { inherit buildLua; }; inhibit-gnome = callPackage ./inhibit-gnome.nix { }; mpris = callPackage ./mpris.nix { }; - mpv-playlistmanager = callPackage ./mpv-playlistmanager.nix { }; + mpv-playlistmanager = callPackage ./mpv-playlistmanager.nix { inherit buildLua; }; mpv-webm = callPackage ./mpv-webm.nix { }; mpvacious = callPackage ./mpvacious.nix { }; - quality-menu = callPackage ./quality-menu.nix { }; + quality-menu = callPackage ./quality-menu.nix { inherit buildLua; }; simple-mpv-webui = callPackage ./simple-mpv-webui.nix { }; sponsorblock = callPackage ./sponsorblock.nix { }; thumbfast = callPackage ./thumbfast.nix { }; - thumbnail = callPackage ./thumbnail.nix { }; + thumbnail = callPackage ./thumbnail.nix { inherit buildLua; }; uosc = callPackage ./uosc.nix { }; visualizer = callPackage ./visualizer.nix { }; vr-reversal = callPackage ./vr-reversal.nix { }; webtorrent-mpv-hook = callPackage ./webtorrent-mpv-hook.nix { }; cutter = callPackage ./cutter.nix { }; } - // (callPackage ./occivink.nix { })) + // (callPackage ./occivink.nix { inherit buildLua; })) // lib.optionalAttrs config.allowAliases { youtube-quality = throw "'youtube-quality' is no longer maintained, use 'quality-menu' instead"; # added 2023-07-14 } diff --git a/pkgs/applications/video/mpv/scripts/mpv-playlistmanager.nix b/pkgs/applications/video/mpv/scripts/mpv-playlistmanager.nix index 720fdaae5b3..8ec05a3cf69 100644 --- a/pkgs/applications/video/mpv/scripts/mpv-playlistmanager.nix +++ b/pkgs/applications/video/mpv/scripts/mpv-playlistmanager.nix @@ -1,6 +1,6 @@ -{ lib, stdenvNoCC, fetchFromGitHub, yt-dlp }: +{ lib, buildLua, fetchFromGitHub, yt-dlp }: -stdenvNoCC.mkDerivation rec { +buildLua rec { pname = "mpv-playlistmanager"; version = "unstable-2023-08-09"; @@ -17,21 +17,12 @@ stdenvNoCC.mkDerivation rec { 'youtube_dl_executable = "${lib.getBin yt-dlp}/bin/yt-dlp"', ''; - dontBuild = true; - - installPhase = '' - runHook preInstall - install -D -t $out/share/mpv/scripts playlistmanager.lua - runHook postInstall - ''; - - passthru.scriptName = "playlistmanager.lua"; + scriptPath = "playlistmanager.lua"; meta = with lib; { description = "Mpv lua script to create and manage playlists"; homepage = "https://github.com/jonniek/mpv-playlistmanager"; license = licenses.unlicense; - platforms = platforms.all; maintainers = with maintainers; [ lunik1 ]; }; } diff --git a/pkgs/applications/video/mpv/scripts/occivink.nix b/pkgs/applications/video/mpv/scripts/occivink.nix index da723fd9102..167e2fef6ac 100644 --- a/pkgs/applications/video/mpv/scripts/occivink.nix +++ b/pkgs/applications/video/mpv/scripts/occivink.nix @@ -1,14 +1,17 @@ { lib -, stdenvNoCC , fetchFromGitHub +, buildLua }: let - script = { n, ... }@p: - stdenvNoCC.mkDerivation (lib.attrsets.recursiveUpdate { - pname = "mpv_${n}"; - passthru.scriptName = "${n}.lua"; - + camelToKebab = let + inherit (lib.strings) match stringAsChars toLower; + isUpper = match "[A-Z]"; + in stringAsChars (c: if isUpper c != null then "-${toLower c}" else c); + + mkScript = name: args: + buildLua (lib.attrsets.recursiveUpdate rec { + pname = camelToKebab name; src = fetchFromGitHub { owner = "occivink"; repo = "mpv-scripts"; @@ -17,37 +20,26 @@ let }; version = "unstable-2022-10-02"; - dontBuild = true; - installPhase = '' - mkdir -p $out/share/mpv/scripts - cp -r scripts/${n}.lua $out/share/mpv/scripts/ - ''; + scriptPath = "scripts/${pname}.lua"; meta = with lib; { homepage = "https://github.com/occivink/mpv-scripts"; license = licenses.unlicense; - platforms = platforms.all; maintainers = with maintainers; [ nicoo ]; }; - - outputHashAlgo = "sha256"; - outputHashMode = "recursive"; - } p); + } args); in -{ +lib.mapAttrs (name: lib.makeOverridable (mkScript name)) { # Usage: `pkgs.mpv.override { scripts = [ pkgs.mpvScripts.seekTo ]; }` - seekTo = script { - n = "seek-to"; + seekTo = { meta.description = "Mpv script for seeking to a specific position"; outputHash = "sha256-3RlbtUivmeoR9TZ6rABiZSd5jd2lFv/8p/4irHMLshs="; }; - blacklistExtensions = script { - n = "blacklist-extensions"; + blacklistExtensions = { meta.description = "Automatically remove playlist entries based on their extension."; outputHash = "sha256-qw9lz8ofmvvh23F9aWLxiU4YofY+YflRETu+nxMhvVE="; }; - } diff --git a/pkgs/applications/video/mpv/scripts/quality-menu.nix b/pkgs/applications/video/mpv/scripts/quality-menu.nix index 45d358843b3..d0eb2ca0119 100644 --- a/pkgs/applications/video/mpv/scripts/quality-menu.nix +++ b/pkgs/applications/video/mpv/scripts/quality-menu.nix @@ -1,33 +1,22 @@ { lib -, stdenvNoCC +, buildLua , fetchFromGitHub , oscSupport ? false }: -stdenvNoCC.mkDerivation rec { +buildLua rec { pname = "mpv-quality-menu"; - version = "4.1.0"; + version = "4.1.1"; src = fetchFromGitHub { owner = "christoph-heinrich"; repo = "mpv-quality-menu"; rev = "v${version}"; - hash = "sha256-93WoTeX61xzbjx/tgBgUVuwyR9MkAUzCfVSrbAC7Ddc="; + hash = "sha256-yrcTxqpLnOI1Tq3khhflO3wzhyeTPuvKifyH5/P57Ns="; }; - dontBuild = true; - - installPhase = '' - runHook preInstall - mkdir -p $out/share/mpv/scripts - cp quality-menu.lua $out/share/mpv/scripts - '' + lib.optionalString oscSupport '' - cp quality-menu-osc.lua $out/share/mpv/scripts - '' + '' - runHook postInstall - ''; - passthru.scriptName = "quality-menu.lua"; + scriptPath = if oscSupport then "*.lua" else passthru.scriptName; meta = with lib; { description = "A userscript for MPV that allows you to change youtube video quality (ytdl-format) on the fly"; diff --git a/pkgs/applications/video/mpv/scripts/thumbfast.nix b/pkgs/applications/video/mpv/scripts/thumbfast.nix index fb231d87ca3..88209f049f6 100644 --- a/pkgs/applications/video/mpv/scripts/thumbfast.nix +++ b/pkgs/applications/video/mpv/scripts/thumbfast.nix @@ -13,7 +13,7 @@ stdenvNoCC.mkDerivation { postPatch = '' substituteInPlace thumbfast.lua \ - --replace 'mpv_path = "mpv"' 'mpv_path = "${lib.getBin mpv-unwrapped}/bin/mpv"' + --replace 'mpv_path = "mpv"' 'mpv_path = "${lib.getExe mpv-unwrapped}"' ''; dontBuild = true; diff --git a/pkgs/applications/video/mpv/scripts/thumbnail.nix b/pkgs/applications/video/mpv/scripts/thumbnail.nix index 60b392a6aa2..29509bd033f 100644 --- a/pkgs/applications/video/mpv/scripts/thumbnail.nix +++ b/pkgs/applications/video/mpv/scripts/thumbnail.nix @@ -1,30 +1,21 @@ -{ lib, stdenvNoCC, fetchFromGitHub, python3 }: +{ lib, buildLua, fetchFromGitHub, python3 }: -stdenvNoCC.mkDerivation rec { +buildLua rec { pname = "mpv-thumbnail-script"; - version = "0.5.2"; + version = "0.5.3"; src = fetchFromGitHub { owner = "marzzzello"; repo = "mpv_thumbnail_script"; rev = version; - sha256 = "sha256-6J1eeuSYyUJmWLIl9WsQ4NzQOBJNO3Cnl5jcPEal4vM="; + sha256 = "sha256-J24Rou7BTE7zoiPlBkWuO9dtYJiuzkuwB4FROuzXzag="; }; nativeBuildInputs = [ python3 ]; + postPatch = "patchShebangs concat_files.py"; + dontBuild = false; - postPatch = '' - patchShebangs concat_files.py - ''; - - installPhase = '' - runHook preInstall - mkdir -p $out/share/mpv/scripts - cp mpv_thumbnail_script_{client_osc,server}.lua $out/share/mpv/scripts - runHook postInstall - ''; - - passthru.scriptName = "mpv_thumbnail_script_{client_osc,server}.lua"; + scriptPath = "mpv_thumbnail_script_{client_osc,server}.lua"; meta = with lib; { description = "A lua script to show preview thumbnails in mpv's OSC seekbar"; diff --git a/pkgs/applications/video/mpv/wrapper.nix b/pkgs/applications/video/mpv/wrapper.nix index b427318121e..a86c9671a48 100644 --- a/pkgs/applications/video/mpv/wrapper.nix +++ b/pkgs/applications/video/mpv/wrapper.nix @@ -97,7 +97,7 @@ let '' + lib.optionalString stdenv.isDarwin '' # wrapProgram can't operate on symlinks rm "$out/Applications/mpv.app/Contents/MacOS/mpv" - makeWrapper "${mpv}/Applications/mpv.app/Contents/MacOS/mpv" "$out/Applications/mpv.app/Contents/MacOS/mpv" ${mostMakeWrapperArgs} + makeWrapper "${mpv}/Applications/mpv.app/Contents/MacOS/mpv-bundle" "$out/Applications/mpv.app/Contents/MacOS/mpv" ${mostMakeWrapperArgs} ''; meta = { |