diff options
Diffstat (limited to 'pkgs/applications/video/mpv')
41 files changed, 999 insertions, 646 deletions
diff --git a/pkgs/applications/video/mpv/0001-fix-darwin-build.patch b/pkgs/applications/video/mpv/0001-fix-darwin-build.patch new file mode 100644 index 0000000000000..c7e486a3c5d14 --- /dev/null +++ b/pkgs/applications/video/mpv/0001-fix-darwin-build.patch @@ -0,0 +1,29 @@ +--- a/osdep/mac/input_helper.swift ++++ b/osdep/mac/input_helper.swift +@@ -18,6 +18,14 @@ + import Cocoa + import Carbon.HIToolbox + ++extension NSCondition { ++ fileprivate func withLock<T>(_ body: () throws -> T) rethrows -> T { ++ self.lock() ++ defer { self.unlock() } ++ return try body() ++ } ++} ++ + class InputHelper: NSObject { + var option: OptionHelper? + var lock = NSCondition() +--- a/audio/out/ao_avfoundation.m ++++ b/audio/out/ao_avfoundation.m +@@ -312,7 +312,8 @@ + ++ #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 120000 + p->observer = [[AVObserver alloc] initWithAO:ao]; + NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; + [center addObserver:p->observer selector:@selector(handleRestartNotification:) name:AVSampleBufferAudioRendererOutputConfigurationDidChangeNotification object:p->renderer]; + [center addObserver:p->observer selector:@selector(handleRestartNotification:) name:AVSampleBufferAudioRendererWasFlushedAutomaticallyNotification object:p->renderer]; +- ++ #endif + return CONTROL_OK; diff --git a/pkgs/applications/video/mpv/darwin-sigtool-no-deep.patch b/pkgs/applications/video/mpv/darwin-sigtool-no-deep.patch deleted file mode 100644 index 74ab97db4e540..0000000000000 --- a/pkgs/applications/video/mpv/darwin-sigtool-no-deep.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/TOOLS/osxbundle.py b/TOOLS/osxbundle.py -index 98699e478b..d02ecf610e 100755 ---- a/TOOLS/osxbundle.py -+++ b/TOOLS/osxbundle.py -@@ -39,7 +39,7 @@ def apply_plist_template(plist_file, version): - print(line.rstrip().replace('${VERSION}', version)) - - def sign_bundle(binary_name): -- sh('codesign --force --deep -s - ' + bundle_path(binary_name)) -+ sh('rcodesign sign ' + bundle_path(binary_name)) - - def bundle_version(): - if os.path.exists('VERSION'): diff --git a/pkgs/applications/video/mpv/default.nix b/pkgs/applications/video/mpv/default.nix index 163729d879b9a..0f9cec9c409bd 100644 --- a/pkgs/applications/video/mpv/default.nix +++ b/pkgs/applications/video/mpv/default.nix @@ -1,133 +1,176 @@ -{ lib -, config -, stdenv -, fetchFromGitHub -, fetchpatch -, addOpenGLRunpath -, bash -, docutils -, meson -, ninja -, pkg-config -, python3 -, ffmpeg -, freefont_ttf -, freetype -, libass -, libpthreadstubs -, nv-codec-headers-11 -, lua -, libuchardet -, libiconv -, xcbuild -, rcodesign +{ + lib, + SDL2, + addOpenGLRunpath, + alsa-lib, + bash, + buildPackages, + callPackage, + config, + darwin, + docutils, + fetchFromGitHub, + ffmpeg, + freefont_ttf, + freetype, + lcms2, + libGL, + libGLU, + libX11, + libXScrnSaver, + libXext, + libXinerama, + libXpresent, + libXrandr, + libXv, + libXxf86vm, + libarchive, + libass, + libbluray, + libbs2b, + libcaca, + libcdio, + libcdio-paranoia, + libdrm, + libdvdnav, + libiconv, + libjack2, + libplacebo, + libpng, + libpthreadstubs, + libpulseaudio, + libsixel, + libtheora, + libuchardet, + libva, + libvdpau, + libxkbcommon, + lua, + mesa, + meson, + mujs, + ninja, + nixosTests, + nv-codec-headers-11, + openalSoft, + pipewire, + pkg-config, + python3, + rubberband, + shaderc, # instead of spirv-cross + speex, + stdenv, + swift, + testers, + vapoursynth, + vulkan-headers, + vulkan-loader, + wayland, + wayland-protocols, + wayland-scanner, + xcbuild, + zimg, -, waylandSupport ? stdenv.isLinux - , wayland - , wayland-protocols - , wayland-scanner - , libxkbcommon - -, x11Support ? stdenv.isLinux - , libGLU, libGL - , libX11 - , libXext - , libXxf86vm - , libXrandr - , libXpresent - -, cddaSupport ? false - , libcdio - , libcdio-paranoia - -, vulkanSupport ? stdenv.isLinux - , libplacebo - , shaderc # instead of spirv-cross - , vulkan-headers - , vulkan-loader - -, drmSupport ? stdenv.isLinux - , libdrm - , mesa - -, alsaSupport ? stdenv.isLinux, alsa-lib -, archiveSupport ? true, libarchive -, bluraySupport ? true, libbluray -, bs2bSupport ? true, libbs2b -, cacaSupport ? true, libcaca -, cmsSupport ? true, lcms2 -, dvdnavSupport ? stdenv.isLinux, libdvdnav -, dvbinSupport ? stdenv.isLinux -, jackaudioSupport ? false, libjack2 -, javascriptSupport ? true, mujs -, libpngSupport ? true, libpng -, openalSupport ? true, openalSoft -, pulseSupport ? config.pulseaudio or stdenv.isLinux, libpulseaudio -, pipewireSupport ? stdenv.isLinux, pipewire -, rubberbandSupport ? true, rubberband -, screenSaverSupport ? true, libXScrnSaver -, sdl2Support ? true, SDL2 -, sixelSupport ? false, libsixel -, speexSupport ? true, speex -, swiftSupport ? stdenv.isDarwin, swift -, theoraSupport ? true, libtheora -, vaapiSupport ? x11Support || waylandSupport, libva -, vapoursynthSupport ? false, vapoursynth -, vdpauSupport ? true, libvdpau -, xineramaSupport ? stdenv.isLinux, libXinerama -, xvSupport ? stdenv.isLinux, libXv -, zimgSupport ? true, zimg -, darwin + # Boolean + alsaSupport ? stdenv.isLinux, + archiveSupport ? true, + bluraySupport ? true, + bs2bSupport ? true, + cacaSupport ? true, + cddaSupport ? false, + cmsSupport ? true, + drmSupport ? stdenv.isLinux, + dvbinSupport ? stdenv.isLinux, + dvdnavSupport ? stdenv.isLinux, + jackaudioSupport ? false, + javascriptSupport ? true, + libpngSupport ? true, + openalSupport ? true, + pipewireSupport ? stdenv.isLinux, + pulseSupport ? config.pulseaudio or stdenv.isLinux, + rubberbandSupport ? true, + screenSaverSupport ? true, + sdl2Support ? !stdenv.isDarwin, + sixelSupport ? false, + speexSupport ? true, + swiftSupport ? stdenv.isDarwin, + theoraSupport ? true, + vaapiSupport ? x11Support || waylandSupport, + vapoursynthSupport ? false, + vdpauSupport ? true, + vulkanSupport ? stdenv.isLinux, + waylandSupport ? stdenv.isLinux, + x11Support ? stdenv.isLinux, + xineramaSupport ? stdenv.isLinux, + xvSupport ? stdenv.isLinux, + zimgSupport ? true, }: let inherit (darwin.apple_sdk_11_0.frameworks) - AVFoundation Accelerate Cocoa CoreAudio CoreFoundation CoreMedia - MediaPlayer VideoToolbox; + AVFoundation + Accelerate + Cocoa + CoreAudio + CoreFoundation + CoreMedia + MediaPlayer + VideoToolbox + ; luaEnv = lua.withPackages (ps: with ps; [ luasocket ]); - overrideSDK = platform: version: - platform // lib.optionalAttrs (platform ? darwinMinVersion) { - darwinMinVersion = version; - }; + overrideSDK = + platform: version: + platform // lib.optionalAttrs (platform ? darwinMinVersion) { darwinMinVersion = version; }; - stdenv' = if swiftSupport && stdenv.isDarwin && stdenv.isx86_64 - then stdenv.override (old: { - buildPlatform = overrideSDK old.buildPlatform "10.15"; - hostPlatform = overrideSDK old.hostPlatform "10.15"; - targetPlatform = overrideSDK old.targetPlatform "10.15"; - }) - else stdenv; -in stdenv'.mkDerivation (finalAttrs: { + stdenv' = + if swiftSupport && stdenv.isDarwin && stdenv.isx86_64 then + stdenv.override (old: { + buildPlatform = overrideSDK old.buildPlatform "11.0"; + hostPlatform = overrideSDK old.hostPlatform "11.0"; + targetPlatform = overrideSDK old.targetPlatform "11.0"; + }) + else + stdenv; +in +stdenv'.mkDerivation (finalAttrs: { pname = "mpv"; - version = "0.37.0"; + version = "0.38.0"; - outputs = [ "out" "dev" "doc" "man" ]; + outputs = [ + "out" + "dev" + "doc" + "man" + ]; src = fetchFromGitHub { owner = "mpv-player"; repo = "mpv"; rev = "v${finalAttrs.version}"; - hash = "sha256-izAz9Iiam7tJAWIQkmn2cKOfoaog8oPKq4sOUtp1nvU="; + hash = "sha256-dFajnCpGlNqUv33A8eFEn8kjtzIPkcBY5j0gNVlaiIY="; }; - patches = [ ./darwin-sigtool-no-deep.patch ]; + patches = [ + # Fix build with Darwin SDK 11 + ./0001-fix-darwin-build.patch + ]; postPatch = lib.concatStringsSep "\n" [ # Don't reference compile time dependencies or create a build outputs cycle # between out and dev '' - substituteInPlace meson.build \ - --replace-fail "conf_data.set_quoted('CONFIGURATION', configuration)" \ - "conf_data.set_quoted('CONFIGURATION', '<ommited>')" + substituteInPlace meson.build \ + --replace-fail "conf_data.set_quoted('CONFIGURATION', configuration)" \ + "conf_data.set_quoted('CONFIGURATION', '<ommited>')" '' # A trick to patchShebang everything except mpv_identify.sh '' - pushd TOOLS - mv mpv_identify.sh mpv_identify - patchShebangs *.py *.sh - mv mpv_identify mpv_identify.sh - popd + pushd TOOLS + mv mpv_identify.sh mpv_identify + patchShebangs *.py *.sh + mv mpv_identify mpv_identify.sh + popd '' ]; @@ -136,81 +179,124 @@ in stdenv'.mkDerivation (finalAttrs: { export SWIFT_LIB_DYNAMIC="${lib.getLib swift.swift}/lib/swift/macosx" ''; - mesonFlags = [ - (lib.mesonOption "default_library" "shared") - (lib.mesonBool "libmpv" true) - (lib.mesonEnable "libarchive" archiveSupport) - (lib.mesonEnable "manpage-build" true) - (lib.mesonEnable "cdda" cddaSupport) - (lib.mesonEnable "dvbin" dvbinSupport) - (lib.mesonEnable "dvdnav" dvdnavSupport) - (lib.mesonEnable "openal" openalSupport) - (lib.mesonEnable "sdl2" sdl2Support) - # Disable whilst Swift isn't supported - (lib.mesonEnable "swift-build" swiftSupport) - (lib.mesonEnable "macos-cocoa-cb" swiftSupport) - ] ++ lib.optionals stdenv.isDarwin [ - # Toggle explicitly because it fails on darwin - (lib.mesonEnable "videotoolbox-pl" vulkanSupport) - ]; + mesonFlags = + [ + (lib.mesonOption "default_library" "shared") + (lib.mesonBool "libmpv" true) + (lib.mesonEnable "libarchive" archiveSupport) + (lib.mesonEnable "manpage-build" true) + (lib.mesonEnable "cdda" cddaSupport) + (lib.mesonEnable "dvbin" dvbinSupport) + (lib.mesonEnable "dvdnav" dvdnavSupport) + (lib.mesonEnable "openal" openalSupport) + (lib.mesonEnable "sdl2" sdl2Support) + # Disable whilst Swift isn't supported + (lib.mesonEnable "swift-build" swiftSupport) + (lib.mesonEnable "macos-cocoa-cb" swiftSupport) + ] + ++ lib.optionals stdenv.isDarwin [ + # Toggle explicitly because it fails on darwin + (lib.mesonEnable "videotoolbox-pl" vulkanSupport) + ]; mesonAutoFeatures = "auto"; - nativeBuildInputs = [ - addOpenGLRunpath - docutils # for rst2man - meson - ninja - pkg-config - ] - ++ lib.optionals stdenv.isDarwin [ xcbuild.xcrun rcodesign ] - ++ lib.optionals swiftSupport [ swift ] - ++ lib.optionals waylandSupport [ wayland-scanner ]; + nativeBuildInputs = + [ + addOpenGLRunpath + docutils # for rst2man + meson + ninja + pkg-config + ] + ++ lib.optionals stdenv.isDarwin [ + buildPackages.darwin.sigtool + xcbuild.xcrun + ] + ++ lib.optionals swiftSupport [ swift ] + ++ lib.optionals waylandSupport [ wayland-scanner ]; - buildInputs = [ - bash - ffmpeg - freetype - libass - libplacebo - libpthreadstubs - libuchardet - luaEnv - python3 - ] ++ lib.optionals alsaSupport [ alsa-lib ] - ++ lib.optionals archiveSupport [ libarchive ] - ++ lib.optionals bluraySupport [ libbluray ] - ++ lib.optionals bs2bSupport [ libbs2b ] - ++ lib.optionals cacaSupport [ libcaca ] - ++ lib.optionals cddaSupport [ libcdio libcdio-paranoia ] - ++ lib.optionals cmsSupport [ lcms2 ] - ++ lib.optionals drmSupport [ libdrm mesa ] - ++ lib.optionals dvdnavSupport [ libdvdnav libdvdnav.libdvdread ] - ++ lib.optionals jackaudioSupport [ libjack2 ] - ++ lib.optionals javascriptSupport [ mujs ] - ++ lib.optionals libpngSupport [ libpng ] - ++ lib.optionals openalSupport [ openalSoft ] - ++ lib.optionals pipewireSupport [ pipewire ] - ++ lib.optionals pulseSupport [ libpulseaudio ] - ++ lib.optionals rubberbandSupport [ rubberband ] + buildInputs = + [ + bash + ffmpeg + freetype + libass + libplacebo + libpthreadstubs + libuchardet + luaEnv + python3 + ] + ++ lib.optionals alsaSupport [ alsa-lib ] + ++ lib.optionals archiveSupport [ libarchive ] + ++ lib.optionals bluraySupport [ libbluray ] + ++ lib.optionals bs2bSupport [ libbs2b ] + ++ lib.optionals cacaSupport [ libcaca ] + ++ lib.optionals cddaSupport [ + libcdio + libcdio-paranoia + ] + ++ lib.optionals cmsSupport [ lcms2 ] + ++ lib.optionals drmSupport [ + libdrm + mesa + ] + ++ lib.optionals dvdnavSupport [ + libdvdnav + libdvdnav.libdvdread + ] + ++ lib.optionals jackaudioSupport [ libjack2 ] + ++ lib.optionals javascriptSupport [ mujs ] + ++ lib.optionals libpngSupport [ libpng ] + ++ lib.optionals openalSupport [ openalSoft ] + ++ lib.optionals pipewireSupport [ pipewire ] + ++ lib.optionals pulseSupport [ libpulseaudio ] + ++ lib.optionals rubberbandSupport [ rubberband ] ++ lib.optionals screenSaverSupport [ libXScrnSaver ] - ++ lib.optionals sdl2Support [ SDL2 ] - ++ lib.optionals sixelSupport [ libsixel ] - ++ lib.optionals speexSupport [ speex ] - ++ lib.optionals theoraSupport [ libtheora ] - ++ lib.optionals vaapiSupport [ libva ] + ++ lib.optionals sdl2Support [ SDL2 ] + ++ lib.optionals sixelSupport [ libsixel ] + ++ lib.optionals speexSupport [ speex ] + ++ lib.optionals theoraSupport [ libtheora ] + ++ lib.optionals vaapiSupport [ libva ] ++ lib.optionals vapoursynthSupport [ vapoursynth ] - ++ lib.optionals vdpauSupport [ libvdpau ] - ++ lib.optionals vulkanSupport [ shaderc vulkan-headers vulkan-loader ] - ++ lib.optionals waylandSupport [ wayland wayland-protocols libxkbcommon ] - ++ lib.optionals x11Support [ libX11 libXext libGLU libGL libXxf86vm libXrandr libXpresent ] - ++ lib.optionals xineramaSupport [ libXinerama ] - ++ lib.optionals xvSupport [ libXv ] - ++ lib.optionals zimgSupport [ zimg ] - ++ lib.optionals stdenv.isLinux [ nv-codec-headers-11 ] - ++ lib.optionals stdenv.isDarwin [ libiconv ] - ++ lib.optionals stdenv.isDarwin [ Accelerate CoreFoundation Cocoa CoreAudio MediaPlayer VideoToolbox ] - ++ lib.optionals (stdenv.isDarwin && swiftSupport) [ AVFoundation CoreMedia ]; + ++ lib.optionals vdpauSupport [ libvdpau ] + ++ lib.optionals vulkanSupport [ + shaderc + vulkan-headers + vulkan-loader + ] + ++ lib.optionals waylandSupport [ + wayland + wayland-protocols + libxkbcommon + ] + ++ lib.optionals x11Support [ + libX11 + libXext + libGLU + libGL + libXxf86vm + libXrandr + libXpresent + ] + ++ lib.optionals xineramaSupport [ libXinerama ] + ++ lib.optionals xvSupport [ libXv ] + ++ lib.optionals zimgSupport [ zimg ] + ++ lib.optionals stdenv.isLinux [ nv-codec-headers-11 ] + ++ lib.optionals stdenv.isDarwin [ libiconv ] + ++ lib.optionals stdenv.isDarwin [ + Accelerate + CoreFoundation + Cocoa + CoreAudio + MediaPlayer + VideoToolbox + ] + ++ lib.optionals (stdenv.isDarwin && swiftSupport) [ + AVFoundation + CoreMedia + ]; postBuild = lib.optionalString stdenv.isDarwin '' pushd .. # Must be run from the source dir because it uses relative paths @@ -218,27 +304,29 @@ in stdenv'.mkDerivation (finalAttrs: { popd ''; - postInstall = '' - # Use a standard font - mkdir -p $out/share/mpv - ln -s ${freefont_ttf}/share/fonts/truetype/FreeSans.ttf $out/share/mpv/subfont.ttf + postInstall = + '' + # Use a standard font + mkdir -p $out/share/mpv + ln -s ${freefont_ttf}/share/fonts/truetype/FreeSans.ttf $out/share/mpv/subfont.ttf - pushd ../TOOLS - cp mpv_identify.sh umpv $out/bin/ - popd - pushd $out/share/applications + pushd ../TOOLS + cp mpv_identify.sh umpv $out/bin/ + popd + pushd $out/share/applications - # patch out smb protocol reference, since our ffmpeg can't handle it - substituteInPlace mpv.desktop --replace-fail "smb," "" + # patch out smb protocol reference, since our ffmpeg can't handle it + substituteInPlace mpv.desktop --replace-fail "smb," "" - sed -e '/Icon=/ ! s|mpv|umpv|g; s|^Exec=.*|Exec=umpv %U|' \ - mpv.desktop > umpv.desktop - printf "NoDisplay=true\n" >> umpv.desktop - popd - '' + lib.optionalString stdenv.isDarwin '' - mkdir -p $out/Applications - cp -r mpv.app $out/Applications - ''; + sed -e '/Icon=/ ! s|mpv|umpv|g; s|^Exec=.*|Exec=umpv %U|' \ + mpv.desktop > umpv.desktop + printf "NoDisplay=true\n" >> umpv.desktop + popd + '' + + lib.optionalString stdenv.isDarwin '' + mkdir -p $out/Applications + cp -r mpv.app $out/Applications + ''; # Set RUNPATH so that libcuda in /run/opengl-driver(-32)/lib can be found. # See the explanation in addOpenGLRunpath. @@ -249,16 +337,29 @@ in stdenv'.mkDerivation (finalAttrs: { passthru = { inherit - # The wrapper consults luaEnv and lua.version - luaEnv - lua - # In the wrapper, we want to reference vapoursynth which has the `python3` - # passthru attribute (which has the `sitePrefix` attribute). This way we'll - # be sure that in the wrapper we'll use the same python3.sitePrefix used to - # build vapoursynth. - vapoursynthSupport - vapoursynth - ; + # The wrapper consults luaEnv and lua.version + luaEnv + lua + # In the wrapper, we want to reference vapoursynth which has the `python3` + # passthru attribute (which has the `sitePrefix` attribute). This way we'll + # be sure that in the wrapper we'll use the same python3.sitePrefix used to + # build vapoursynth. + vapoursynthSupport + vapoursynth + ; + + wrapper = callPackage ./wrapper.nix { }; + scripts = callPackage ./scripts { }; + + tests = { + inherit (nixosTests) mpv; + + version = testers.testVersion { package = finalAttrs.finalPackage; }; + pkg-config = testers.hasPkgConfigModules { + package = finalAttrs.finalPackage; + moduleNames = [ "mpv" ]; + }; + }; }; meta = { @@ -272,7 +373,11 @@ in stdenv'.mkDerivation (finalAttrs: { license = lib.licenses.gpl2Plus; mainProgram = "mpv"; maintainers = with lib.maintainers; [ - AndersonTorres fpletz globin ma27 tadeokondrak + AndersonTorres + fpletz + globin + ma27 + tadeokondrak ]; platforms = lib.platforms.unix; }; diff --git a/pkgs/applications/video/mpv/scripts/autosubsync-mpv.nix b/pkgs/applications/video/mpv/scripts/autosubsync-mpv.nix new file mode 100644 index 0000000000000..d162da18c018a --- /dev/null +++ b/pkgs/applications/video/mpv/scripts/autosubsync-mpv.nix @@ -0,0 +1,38 @@ +{ + lib, + fetchFromGitHub, + buildLua, + alass, +}: + +buildLua { + pname = "autosubsync-mpv"; + version = "0-unstable-2022-12-26"; + + src = fetchFromGitHub { + owner = "joaquintorres"; + repo = "autosubsync-mpv"; + rev = "22cb928ecd94cc8cadaf8c354438123c43e0c70d"; + sha256 = "sha256-XQPFC7l9MTZAW5FfULRQJfu/7FuGj9bbjQUZhNv0rlc="; + }; + + # While nixpkgs only packages alass, we might as well make that the default + patchPhase = '' + runHook prePatch + substituteInPlace autosubsync.lua \ + --replace-warn 'alass_path = ""' 'alass_path = "${alass}/bin/alass-cli"' \ + --replace-warn 'audio_subsync_tool = "ask"' 'audio_subsync_tool = "alass"' \ + --replace-warn 'altsub_subsync_tool = "ask"' 'altsub_subsync_tool = "alass"' + runHook postPatch + ''; + + scriptPath = "./"; + passthru.scriptName = "autosubsync-mpv"; + + meta = with lib; { + description = "Automatically sync subtitles in mpv using the `n` button"; + homepage = "https://github.com/joaquintorres/autosubsync-mpv"; + maintainers = with maintainers; [ kovirobi ]; + license = licenses.mit; + }; +} diff --git a/pkgs/applications/video/mpv/scripts/buildLua.nix b/pkgs/applications/video/mpv/scripts/buildLua.nix index 8db7d4b1aa3c9..2e25ee55b28a0 100644 --- a/pkgs/applications/video/mpv/scripts/buildLua.nix +++ b/pkgs/applications/video/mpv/scripts/buildLua.nix @@ -1,5 +1,4 @@ -{ lib -, stdenvNoCC }: +{ lib, stdenvNoCC }: let # Escape strings for embedding in shell scripts @@ -10,74 +9,90 @@ let 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 - ; + extendedBy = + args: orig: self: + let + super = args self; + in + lib.recursiveUpdate (orig super) super; in -lib.makeOverridable (args: stdenvNoCC.mkDerivation (extendedBy - (if lib.isFunction args then args else (_: args)) ( - { pname - , extraScripts ? [] - , ... }@args: - let - strippedName = with builtins; - let groups = match "mpv[-_](.*)" pname; in - if groups != null - then head groups - else pname - ; - # either passthru.scriptName, inferred from scriptPath, or from pname - scriptName = (args.passthru or {}).scriptName or ( - if args ? scriptPath - then fileName args.scriptPath - else "${strippedName}.lua" - ); - scriptPath = args.scriptPath or "./${scriptName}"; - in { - dontBuild = true; - preferLocalBuild = true; +lib.makeOverridable ( + args: + stdenvNoCC.mkDerivation ( + extendedBy (if lib.isFunction args then args else (_: args)) ( + { + pname, + extraScripts ? [ ], + ... + }@args: + let + strippedName = + with builtins; + let + groups = match "mpv[-_](.*)" pname; + in + if groups != null then head groups else pname; + # either passthru.scriptName, inferred from scriptPath, or from pname + scriptName = + (args.passthru or { }).scriptName + or (if args ? scriptPath then fileName args.scriptPath else "${strippedName}.lua"); + scriptPath = args.scriptPath or "./${scriptName}"; + in + { + dontBuild = true; + preferLocalBuild = true; - # Prevent `patch` from emitting `.orig` files (that end up in the output) - patchFlags = [ "--no-backup-if-mismatch" "-p1" ]; + # Prevent `patch` from emitting `.orig` files (that end up in the output) + patchFlags = [ + "--no-backup-if-mismatch" + "-p1" + ]; - outputHashMode = "recursive"; - installPhase = '' - runHook preInstall + outputHashMode = "recursive"; + installPhase = '' + runHook preInstall - if [ -d "${scriptPath}" ]; then - [ -f "${scriptPath}/main.lua" ] || { - echo "Script directory '${scriptPath}' does not contain 'main.lua'" >&2 - exit 1 - } - [ ${with builtins; toString (length extraScripts)} -eq 0 ] || { - echo "mpvScripts.buildLua does not support 'extraScripts'" \ - "when 'scriptPath' is a directory" >&2 - exit 1 - } - mkdir -p "${scriptsDir}" - cp -a "${scriptPath}" "${scriptsDir}/${scriptName}" - else - install -m644 -Dt "${scriptsDir}" ${escaped scriptPath} - ${lib.optionalString (extraScripts != []) ''cp -at "${scriptsDir}/" ${escapedList extraScripts}''} - fi + if [ -d "${scriptPath}" ]; then + [ -f "${scriptPath}/main.lua" ] || { + echo "Script directory '${scriptPath}' does not contain 'main.lua'" >&2 + exit 1 + } + [ ${with builtins; toString (length extraScripts)} -eq 0 ] || { + echo "mpvScripts.buildLua does not support 'extraScripts'" \ + "when 'scriptPath' is a directory" >&2 + exit 1 + } + mkdir -p "${scriptsDir}" + cp -a "${scriptPath}" "${scriptsDir}/${scriptName}" + else + install -m644 -Dt "${scriptsDir}" ${escaped scriptPath} + ${ + lib.optionalString (extraScripts != [ ]) ''cp -at "${scriptsDir}/" ${escapedList extraScripts}'' + } + fi - runHook postInstall - ''; + runHook postInstall + ''; - passthru = { inherit scriptName; }; - meta = { - platforms = lib.platforms.all; - } // ( - let pos = - if (args.meta or {}) ? description then - builtins.unsafeGetAttrPos "description" args.meta - else - builtins.unsafeGetAttrPos "pname" args; - in lib.optionalAttrs - (pos != null) - { position = "${pos.file}:${toString pos.line}"; } - ); - }) -)) + passthru = { + inherit scriptName; + }; + meta = + { + platforms = lib.platforms.all; + } + // ( + let + pos = + if (args.meta or { }) ? description then + builtins.unsafeGetAttrPos "description" args.meta + else + builtins.unsafeGetAttrPos "pname" args; + in + lib.optionalAttrs (pos != null) { position = "${pos.file}:${toString pos.line}"; } + ); + } + ) + ) +) diff --git a/pkgs/applications/video/mpv/scripts/chapterskip.nix b/pkgs/applications/video/mpv/scripts/chapterskip.nix index 6c6fc4ba51fee..b1b993df3692a 100644 --- a/pkgs/applications/video/mpv/scripts/chapterskip.nix +++ b/pkgs/applications/video/mpv/scripts/chapterskip.nix @@ -1,7 +1,9 @@ -{ lib -, fetchFromGitHub -, unstableGitUpdater -, buildLua }: +{ + lib, + fetchFromGitHub, + unstableGitUpdater, + buildLua, +}: buildLua { pname = "chapterskip"; @@ -9,20 +11,20 @@ buildLua { version = "0-unstable-2022-09-08"; src = fetchFromGitHub { owner = "po5"; - repo = "chapterskip"; - rev = "b26825316e3329882206ae78dc903ebc4613f039"; - hash = "sha256-OTrLQE3rYvPQamEX23D6HttNjx3vafWdTMxTiWpDy90="; + repo = "chapterskip"; + rev = "b26825316e3329882206ae78dc903ebc4613f039"; + hash = "sha256-OTrLQE3rYvPQamEX23D6HttNjx3vafWdTMxTiWpDy90="; }; - passthru.updateScript = unstableGitUpdater {}; + passthru.updateScript = unstableGitUpdater { }; meta = { description = "Automatically skips chapters based on title"; longDescription = '' - MPV script that skips chapters based on their title, categorized using regexes. - The set of skipped categories can be configured globally, or by an auto-profile. + MPV script that skips chapters based on their title, categorized using regexes. + The set of skipped categories can be configured globally, or by an auto-profile. ''; homepage = "https://github.com/po5/chapterskip"; - license = lib.licenses.unfree; # https://github.com/po5/chapterskip/issues/10 + license = lib.licenses.unfree; # https://github.com/po5/chapterskip/issues/10 maintainers = with lib.maintainers; [ nicoo ]; }; } diff --git a/pkgs/applications/video/mpv/scripts/convert.nix b/pkgs/applications/video/mpv/scripts/convert.nix index d1fdc9c801bb7..1df83df46d8c4 100644 --- a/pkgs/applications/video/mpv/scripts/convert.nix +++ b/pkgs/applications/video/mpv/scripts/convert.nix @@ -1,11 +1,12 @@ -{ lib -, fetchgit -, unstableGitUpdater +{ + lib, + fetchgit, + unstableGitUpdater, -, buildLua -, libnotify -, mkvtoolnix-cli -, yad + buildLua, + libnotify, + mkvtoolnix-cli, + yad, }: buildLua { @@ -16,20 +17,20 @@ buildLua { rev = "f95cee43e390e843a47e8ec9d1711a12a8cd343d"; sha256 = "13m7l4sy2r8jv2sfrb3vvqvnim4a9ilnv28q5drlg09v298z3mck"; }; - passthru.updateScript = unstableGitUpdater {}; + passthru.updateScript = unstableGitUpdater { }; patches = [ ./convert.patch ]; postPatch = '' substituteInPlace convert_script.lua \ - --replace 'mkvpropedit_exe = "mkvpropedit"' \ - 'mkvpropedit_exe = "${mkvtoolnix-cli}/bin/mkvpropedit"' \ - --replace 'mkvmerge_exe = "mkvmerge"' \ - 'mkvmerge_exe = "${mkvtoolnix-cli}/bin/mkvmerge"' \ - --replace 'yad_exe = "yad"' \ - 'yad_exe = "${yad}/bin/yad"' \ - --replace 'notify_send_exe = "notify-send"' \ - 'notify_send_exe = "${libnotify}/bin/notify-send"' \ + --replace-fail 'mkvpropedit_exe = "mkvpropedit"' \ + 'mkvpropedit_exe = "${lib.getExe' mkvtoolnix-cli "mkvpropedit"}"' \ + --replace-fail 'mkvmerge_exe = "mkvmerge"' \ + 'mkvmerge_exe = "${lib.getExe' mkvtoolnix-cli "mkvmerge"}"' \ + --replace-fail 'yad_exe = "yad"' \ + 'yad_exe = "${lib.getExe yad}"' \ + --replace-fail 'notify_send_exe = "notify-send"' \ + 'notify_send_exe = "${lib.getExe libnotify}"' \ ''; scriptPath = "convert_script.lua"; diff --git a/pkgs/applications/video/mpv/scripts/cutter.nix b/pkgs/applications/video/mpv/scripts/cutter.nix index ac2f518a9b5ab..b051c08a85470 100644 --- a/pkgs/applications/video/mpv/scripts/cutter.nix +++ b/pkgs/applications/video/mpv/scripts/cutter.nix @@ -1,4 +1,10 @@ -{ lib, buildLua, fetchFromGitHub, makeWrapper, unstableGitUpdater }: +{ + lib, + buildLua, + fetchFromGitHub, + makeWrapper, + unstableGitUpdater, +}: buildLua { pname = "video-cutter"; @@ -10,19 +16,19 @@ buildLua { rev = "01a0396c075d5f8bbd1de5b571e6231f8899ab65"; sha256 = "sha256-veoRFzUCRH8TrvR7x+WWoycpDyxqrJZ/bnp61dVc0pE="; }; - passthru.updateScript = unstableGitUpdater {}; + passthru.updateScript = unstableGitUpdater { }; nativeBuildInputs = [ makeWrapper ]; postPatch = '' substituteInPlace cutter.lua \ - --replace '~/.config/mpv/scripts/c_concat.sh' '${placeholder "out"}/share/mpv/scripts/c_concat.sh' + --replace-fail '~/.config/mpv/scripts/c_concat.sh' '${placeholder "out"}/share/mpv/scripts/c_concat.sh' # needs to be ran separately so that we can replace everything, and not every single mention explicitly # original script places them in the scripts folder, just spawning unnecessary errors # i know that hardcoding .config and especially the .mpv directory isn't best practice, but I didn't want to deviate too much from upstream substituteInPlace cutter.lua \ - --replace '~/.config/mpv/scripts' "''${XDG_CONFIG_HOME:-~/.config}/mpv/cutter" + --replace-fail '~/.config/mpv/scripts' "''${XDG_CONFIG_HOME:-~/.config}/mpv/cutter" ''; passthru.scriptName = "cutter.lua"; diff --git a/pkgs/applications/video/mpv/scripts/default.nix b/pkgs/applications/video/mpv/scripts/default.nix index ce5188c09d294..c9e433e6fe00d 100644 --- a/pkgs/applications/video/mpv/scripts/default.nix +++ b/pkgs/applications/video/mpv/scripts/default.nix @@ -1,111 +1,147 @@ -{ lib -, config -, newScope -, runCommand +{ + lib, + config, + newScope, + runCommand, }: let - unionOfDisjoints = lib.fold lib.attrsets.unionOfDisjoint {}; + unionOfDisjoints = lib.fold lib.attrsets.unionOfDisjoint { }; - addTests = name: drv: - if ! lib.isDerivation drv then + addTests = + name: drv: + if !lib.isDerivation drv then drv - else let - inherit (drv) scriptName; - scriptPath = "share/mpv/scripts/${scriptName}"; - fullScriptPath = "${drv}/${scriptPath}"; - in drv.overrideAttrs (old: { passthru = (old.passthru or {}) // { tests = unionOfDisjoints [ - (old.passthru.tests or {}) + else + let + inherit (drv) scriptName; + scriptPath = "share/mpv/scripts/${scriptName}"; + fullScriptPath = "${drv}/${scriptPath}"; + in + drv.overrideAttrs (old: { + passthru = (old.passthru or { }) // { + tests = unionOfDisjoints [ + (old.passthru.tests or { }) - { - scriptName-is-valid = runCommand "mpvScripts.${name}.passthru.tests.scriptName-is-valid" { - meta.maintainers = with lib.maintainers; [ nicoo ]; - preferLocalBuild = true; - } '' - if [ -e "${fullScriptPath}" ]; then - touch $out - else - echo "mpvScripts.\"${name}\" does not contain a script named \"${scriptName}\"" >&2 - exit 1 - fi - ''; - } + { + scriptName-is-valid = + runCommand "mpvScripts.${name}.passthru.tests.scriptName-is-valid" + { + meta.maintainers = with lib.maintainers; [ nicoo ]; + preferLocalBuild = true; + } + '' + if [ -e "${fullScriptPath}" ]; then + touch $out + else + echo "mpvScripts.\"${name}\" does not contain a script named \"${scriptName}\"" >&2 + exit 1 + fi + ''; + } - # can't check whether `fullScriptPath` is a directory, in pure-evaluation mode - (with lib; optionalAttrs (! any (s: hasSuffix s drv.passthru.scriptName) [ ".js" ".lua" ".so" ]) { - single-main-in-script-dir = runCommand "mpvScripts.${name}.passthru.tests.single-main-in-script-dir" { - meta.maintainers = with lib.maintainers; [ nicoo ]; - preferLocalBuild = true; - } '' - die() { - echo "$@" >&2 - exit 1 - } + # can't check whether `fullScriptPath` is a directory, in pure-evaluation mode + ( + with lib; + optionalAttrs + ( + !any (s: hasSuffix s drv.passthru.scriptName) [ + ".js" + ".lua" + ".so" + ] + ) + { + single-main-in-script-dir = + runCommand "mpvScripts.${name}.passthru.tests.single-main-in-script-dir" + { + meta.maintainers = with lib.maintainers; [ nicoo ]; + preferLocalBuild = true; + } + '' + die() { + echo "$@" >&2 + exit 1 + } - cd "${drv}/${scriptPath}" # so the glob expands to filenames only - mains=( main.* ) - if [ "''${#mains[*]}" -eq 1 ]; then - touch $out - elif [ "''${#mains[*]}" -eq 0 ]; then - die "'${scriptPath}' contains no 'main.*' file" - else - die "'${scriptPath}' contains multiple 'main.*' files:" "''${mains[*]}" - fi - ''; - }) - ]; }; }); + cd "${drv}/${scriptPath}" # so the glob expands to filenames only + mains=( main.* ) + if [ "''${#mains[*]}" -eq 1 ]; then + touch $out + elif [ "''${#mains[*]}" -eq 0 ]; then + die "'${scriptPath}' contains no 'main.*' file" + else + die "'${scriptPath}' contains multiple 'main.*' files:" "''${mains[*]}" + fi + ''; + } + ) + ]; + }; + }); - scope = self: let - inherit (self) callPackage; - in lib.mapAttrs addTests { - inherit (callPackage ./mpv.nix { }) - acompressor autocrop autodeint autoload; - inherit (callPackage ./occivink.nix { }) - blacklistExtensions seekTo; + scope = + self: + let + inherit (self) callPackage; + in + lib.mapAttrs addTests { + inherit (callPackage ./mpv.nix { }) + acompressor + autocrop + autodeint + autoload + ; + inherit (callPackage ./occivink.nix { }) blacklistExtensions seekTo; - buildLua = callPackage ./buildLua.nix { }; - chapterskip = callPackage ./chapterskip.nix { }; - convert = callPackage ./convert.nix { }; - cutter = callPackage ./cutter.nix { }; - dynamic-crop = callPackage ./dynamic-crop.nix { }; - inhibit-gnome = callPackage ./inhibit-gnome.nix { }; - memo = callPackage ./memo.nix { }; - manga-reader = callPackage ./manga-reader.nix { }; - modernx = callPackage ./modernx.nix { }; - modernx-zydezu = callPackage ./modernx-zydezu.nix { }; - mpris = callPackage ./mpris.nix { }; - mpv-cheatsheet = callPackage ./mpv-cheatsheet.nix { }; - mpv-notify-send = callPackage ./mpv-notify-send.nix { }; - mpv-osc-modern = callPackage ./mpv-osc-modern.nix { }; - mpv-playlistmanager = callPackage ./mpv-playlistmanager.nix { }; - mpv-slicing = callPackage ./mpv-slicing.nix { }; - mpv-webm = callPackage ./mpv-webm.nix { }; - mpvacious = callPackage ./mpvacious.nix { }; - quack = callPackage ./quack.nix { }; - quality-menu = callPackage ./quality-menu.nix { }; - reload = callPackage ./reload.nix { }; - simple-mpv-webui = callPackage ./simple-mpv-webui.nix { }; - sponsorblock = callPackage ./sponsorblock.nix { }; - sponsorblock-minimal = callPackage ./sponsorblock-minimal.nix { }; - thumbfast = callPackage ./thumbfast.nix { }; - thumbnail = callPackage ./thumbnail.nix { }; - uosc = callPackage ./uosc.nix { }; - videoclip = callPackage ./videoclip.nix { }; - visualizer = callPackage ./visualizer.nix { }; - vr-reversal = callPackage ./vr-reversal.nix { }; - webtorrent-mpv-hook = callPackage ./webtorrent-mpv-hook.nix { }; - youtube-upnext = callPackage ./youtube-upnext.nix { }; - }; + buildLua = callPackage ./buildLua.nix { }; + autosubsync-mpv = callPackage ./autosubsync-mpv.nix { }; + chapterskip = callPackage ./chapterskip.nix { }; + convert = callPackage ./convert.nix { }; + cutter = callPackage ./cutter.nix { }; + dynamic-crop = callPackage ./dynamic-crop.nix { }; + evafast = callPackage ./evafast.nix { }; + inhibit-gnome = callPackage ./inhibit-gnome.nix { }; + memo = callPackage ./memo.nix { }; + manga-reader = callPackage ./manga-reader.nix { }; + modernx = callPackage ./modernx.nix { }; + modernx-zydezu = callPackage ./modernx-zydezu.nix { }; + mpris = callPackage ./mpris.nix { }; + mpv-cheatsheet = callPackage ./mpv-cheatsheet.nix { }; + mpv-notify-send = callPackage ./mpv-notify-send.nix { }; + mpv-osc-modern = callPackage ./mpv-osc-modern.nix { }; + mpv-playlistmanager = callPackage ./mpv-playlistmanager.nix { }; + mpv-slicing = callPackage ./mpv-slicing.nix { }; + mpv-webm = callPackage ./mpv-webm.nix { }; + mpvacious = callPackage ./mpvacious.nix { }; + quack = callPackage ./quack.nix { }; + quality-menu = callPackage ./quality-menu.nix { }; + reload = callPackage ./reload.nix { }; + simple-mpv-webui = callPackage ./simple-mpv-webui.nix { }; + sponsorblock = callPackage ./sponsorblock.nix { }; + sponsorblock-minimal = callPackage ./sponsorblock-minimal.nix { }; + thumbfast = callPackage ./thumbfast.nix { }; + thumbnail = callPackage ./thumbnail.nix { }; + uosc = callPackage ./uosc.nix { }; + videoclip = callPackage ./videoclip.nix { }; + visualizer = callPackage ./visualizer.nix { }; + vr-reversal = callPackage ./vr-reversal.nix { }; + webtorrent-mpv-hook = callPackage ./webtorrent-mpv-hook.nix { }; + youtube-upnext = callPackage ./youtube-upnext.nix { }; + }; aliases = { youtube-quality = throw "'youtube-quality' is no longer maintained, use 'quality-menu' instead"; # added 2023-07-14 }; in -with lib; pipe scope [ +with lib; +pipe scope [ (makeScope newScope) - (self: - assert builtins.intersectAttrs self aliases == {}; - self // optionalAttrs config.allowAliases aliases) + ( + self: + assert builtins.intersectAttrs self aliases == { }; + self // optionalAttrs config.allowAliases aliases + ) recurseIntoAttrs ] diff --git a/pkgs/applications/video/mpv/scripts/dynamic-crop.nix b/pkgs/applications/video/mpv/scripts/dynamic-crop.nix index f2cd7dc070166..541c83d5258ff 100644 --- a/pkgs/applications/video/mpv/scripts/dynamic-crop.nix +++ b/pkgs/applications/video/mpv/scripts/dynamic-crop.nix @@ -1,17 +1,18 @@ -{ lib -, fetchFromGitHub -, unstableGitUpdater -, buildLua +{ + lib, + fetchFromGitHub, + unstableGitUpdater, + buildLua, }: buildLua { pname = "dynamic-crop"; - version = "0-unstable-2023-12-22"; + version = "0-unstable-2024-06-22"; src = fetchFromGitHub { owner = "Ashyni"; repo = "mpv-scripts"; - rev = "c79a46ba03631eb2a9b4f598aab0b723f03fc531"; - hash = "sha256-W4Dj2tyJHeHLqAndrzllKs4iwMe3Tu8rfzEGBHuke6s="; + rev = "1fadd5ea3e31818db33c9372c40161db6fc1bdd3"; + hash = "sha256-nC0Iw+9PSGxc3OdYhEmFVa49Sw+rIbuFhgZvAphP4cM="; }; passthru.scriptName = "dynamic-crop.lua"; diff --git a/pkgs/applications/video/mpv/scripts/evafast.nix b/pkgs/applications/video/mpv/scripts/evafast.nix new file mode 100644 index 0000000000000..5260adb1a8efd --- /dev/null +++ b/pkgs/applications/video/mpv/scripts/evafast.nix @@ -0,0 +1,28 @@ +{ + fetchFromGitHub, + buildLua, + lib, + unstableGitUpdater, +}: + +buildLua { + pname = "evafast"; + version = "0-unstable-2024-02-09"; + + src = fetchFromGitHub { + owner = "po5"; + repo = "evafast"; + rev = "92af3e2e1c756ce83f9d0129c780caeef1131a0b"; + hash = "sha256-BGWD2XwVu8zOSiDJ+9oWi8aPN2Wkw0Y0gF58X4f+tdI="; + }; + + # Drop the `branch` parameter once upstream merges `rewrite` back into `master` + passthru.updateScript = unstableGitUpdater { branch = "rewrite"; }; + + meta = with lib; { + description = "Seeking and hybrid fastforwarding like VHS"; + homepage = "https://github.com/po5/evafast"; + license = licenses.unfree; # no license; see https://github.com/po5/evafast/issues/15 + maintainers = with lib.maintainers; [ purrpurrn ]; + }; +} diff --git a/pkgs/applications/video/mpv/scripts/inhibit-gnome.nix b/pkgs/applications/video/mpv/scripts/inhibit-gnome.nix index 618c74adea930..02a54a2cf4751 100644 --- a/pkgs/applications/video/mpv/scripts/inhibit-gnome.nix +++ b/pkgs/applications/video/mpv/scripts/inhibit-gnome.nix @@ -1,4 +1,12 @@ -{ lib, stdenv, fetchFromGitHub, gitUpdater, pkg-config, dbus, mpv-unwrapped }: +{ + lib, + stdenv, + fetchFromGitHub, + gitUpdater, + pkg-config, + dbus, + mpv-unwrapped, +}: stdenv.mkDerivation rec { pname = "mpv-inhibit-gnome"; @@ -10,13 +18,14 @@ stdenv.mkDerivation rec { rev = "v${version}"; hash = "sha256-LSGg5gAQE2JpepBqhz6D6d3NlqYaU4bjvYf1F+oLphQ="; }; - passthru.updateScript = gitUpdater { - rev-prefix = "v"; - }; + passthru.updateScript = gitUpdater { rev-prefix = "v"; }; nativeBuildInputs = [ pkg-config ]; - buildInputs = [ dbus mpv-unwrapped ]; + buildInputs = [ + dbus + mpv-unwrapped + ]; passthru.scriptName = "mpv_inhibit_gnome.so"; diff --git a/pkgs/applications/video/mpv/scripts/manga-reader.nix b/pkgs/applications/video/mpv/scripts/manga-reader.nix index 9a9621cb34d0e..4d8007d98d8d7 100644 --- a/pkgs/applications/video/mpv/scripts/manga-reader.nix +++ b/pkgs/applications/video/mpv/scripts/manga-reader.nix @@ -22,7 +22,7 @@ buildLua rec { longDescription = '' mpv-manga-reader is a script aimed at making mpv a usable manga reader. ''; - homepage = "https://github.com//mpv-manga-reader"; + homepage = "https://github.com/Dudemanguy/mpv-manga-reader"; license = lib.licenses.gpl3; maintainers = with lib.maintainers; [ idlip ]; }; diff --git a/pkgs/applications/video/mpv/scripts/memo.nix b/pkgs/applications/video/mpv/scripts/memo.nix index 5361b796268e1..5d9e2b50fae27 100644 --- a/pkgs/applications/video/mpv/scripts/memo.nix +++ b/pkgs/applications/video/mpv/scripts/memo.nix @@ -1,7 +1,8 @@ -{ fetchFromGitHub -, buildLua -, lib -, unstableGitUpdater +{ + fetchFromGitHub, + buildLua, + lib, + unstableGitUpdater, }: buildLua { @@ -15,10 +16,10 @@ buildLua { hash = "sha256-m8ikXuw7PM4Btg8w7ufLneKA4fnYjMyfVJYueZILMw8="; }; - passthru.updateScript = unstableGitUpdater {}; + passthru.updateScript = unstableGitUpdater { }; meta = with lib; { - description = "A recent files menu for mpv"; + description = "Recent files menu for mpv"; homepage = "https://github.com/po5/memo"; license = licenses.gpl3Only; maintainers = with lib.maintainers; [ purrpurrn ]; diff --git a/pkgs/applications/video/mpv/scripts/modernx-zydezu.nix b/pkgs/applications/video/mpv/scripts/modernx-zydezu.nix index 36b20fe11205c..3ef673ab518f3 100644 --- a/pkgs/applications/video/mpv/scripts/modernx-zydezu.nix +++ b/pkgs/applications/video/mpv/scripts/modernx-zydezu.nix @@ -1,19 +1,20 @@ -{ lib -, buildLua -, fetchFromGitHub -, makeFontsConf -, nix-update-script +{ + lib, + buildLua, + fetchFromGitHub, + makeFontsConf, + nix-update-script, }: buildLua (finalAttrs: { pname = "modernx-zydezu"; - version = "0.2.9"; + version = "0.3.5.5"; scriptPath = "modernx.lua"; src = fetchFromGitHub { owner = "zydezu"; repo = "ModernX"; rev = finalAttrs.version; - hash = "sha256-Tq/v8EbojvOSSwbu8kdbLVxZWZNi1UH6zAPTcsUcgog"; + hash = "sha256-sPpVwI8w5JsP/jML0viOSqhyYBVKfxWuKbxHkX3GVug="; }; postInstall = '' @@ -31,9 +32,12 @@ buildLua (finalAttrs: { passthru.updateScript = nix-update-script { }; meta = with lib; { - description = "A modern OSC UI replacement for MPV that retains the functionality of the default OSC"; + description = "Modern OSC UI replacement for MPV that retains the functionality of the default OSC"; homepage = "https://github.com/zydezu/ModernX"; license = licenses.lgpl21Plus; - maintainers = with maintainers; [ Guanran928 ]; + maintainers = with maintainers; [ + luftmensch-luftmensch + Guanran928 + ]; }; }) diff --git a/pkgs/applications/video/mpv/scripts/modernx.nix b/pkgs/applications/video/mpv/scripts/modernx.nix index 340b169a0c03d..28a50e15d5d83 100644 --- a/pkgs/applications/video/mpv/scripts/modernx.nix +++ b/pkgs/applications/video/mpv/scripts/modernx.nix @@ -1,8 +1,9 @@ -{ lib -, buildLua -, fetchFromGitHub -, makeFontsConf -, nix-update-script +{ + lib, + buildLua, + fetchFromGitHub, + makeFontsConf, + nix-update-script, }: buildLua (finalAttrs: { pname = "modernx"; @@ -31,7 +32,7 @@ buildLua (finalAttrs: { passthru.updateScript = nix-update-script { }; meta = with lib; { - description = "A modern OSC UI replacement for MPV that retains the functionality of the default OSC"; + description = "Modern OSC UI replacement for MPV that retains the functionality of the default OSC"; homepage = "https://github.com/cyl0/ModernX"; license = licenses.lgpl21Plus; maintainers = with maintainers; [ Guanran928 ]; diff --git a/pkgs/applications/video/mpv/scripts/mpris.nix b/pkgs/applications/video/mpv/scripts/mpris.nix index 338f0a8dd482f..fbb1a8f685838 100644 --- a/pkgs/applications/video/mpv/scripts/mpris.nix +++ b/pkgs/applications/video/mpv/scripts/mpris.nix @@ -1,4 +1,13 @@ -{ lib, stdenv, fetchFromGitHub, gitUpdater, pkg-config, glib, mpv-unwrapped, ffmpeg }: +{ + lib, + stdenv, + fetchFromGitHub, + gitUpdater, + pkg-config, + glib, + mpv-unwrapped, + ffmpeg, +}: stdenv.mkDerivation rec { pname = "mpv-mpris"; @@ -10,14 +19,18 @@ stdenv.mkDerivation rec { rev = version; hash = "sha256-vZIO6ILatIWa9nJYOp4AMKwvaZLahqYWRLMDOizyBI0="; }; - passthru.updateScript = gitUpdater {}; + passthru.updateScript = gitUpdater { }; nativeBuildInputs = [ pkg-config ]; - buildInputs = [ glib mpv-unwrapped ffmpeg ]; + buildInputs = [ + glib + mpv-unwrapped + ffmpeg + ]; postPatch = '' - substituteInPlace Makefile --replace 'PKG_CONFIG =' 'PKG_CONFIG ?=' + substituteInPlace Makefile --replace-fail 'PKG_CONFIG =' 'PKG_CONFIG ?=' ''; installFlags = [ "SCRIPTS_DIR=${placeholder "out"}/share/mpv/scripts" ]; diff --git a/pkgs/applications/video/mpv/scripts/mpv-cheatsheet.nix b/pkgs/applications/video/mpv/scripts/mpv-cheatsheet.nix index a15f54d01ef22..c0c62867c1ee2 100644 --- a/pkgs/applications/video/mpv/scripts/mpv-cheatsheet.nix +++ b/pkgs/applications/video/mpv/scripts/mpv-cheatsheet.nix @@ -1,8 +1,9 @@ -{ lib -, fetchFromGitHub -, gitUpdater -, nodePackages -, stdenvNoCC +{ + lib, + fetchFromGitHub, + gitUpdater, + nodePackages, + stdenvNoCC, }: stdenvNoCC.mkDerivation (finalAttrs: { pname = "mpv-cheatsheet"; @@ -16,9 +17,7 @@ stdenvNoCC.mkDerivation (finalAttrs: { }; passthru.updateScript = gitUpdater { rev-prefix = "v"; }; - nativeBuildInputs = [ - nodePackages.browserify - ]; + nativeBuildInputs = [ nodePackages.browserify ]; buildPhase = '' runHook preBuild @@ -36,7 +35,6 @@ stdenvNoCC.mkDerivation (finalAttrs: { runHook postInstall ''; - passthru.scriptName = "cheatsheet.js"; meta = with lib; { diff --git a/pkgs/applications/video/mpv/scripts/mpv-notify-send.nix b/pkgs/applications/video/mpv/scripts/mpv-notify-send.nix index 04b03670b79f2..b103a45d275bf 100644 --- a/pkgs/applications/video/mpv/scripts/mpv-notify-send.nix +++ b/pkgs/applications/video/mpv/scripts/mpv-notify-send.nix @@ -1,9 +1,11 @@ -{ lib -, buildLua -, fetchFromGitHub -, fetchpatch -, unstableGitUpdater -, libnotify }: +{ + lib, + buildLua, + fetchFromGitHub, + fetchpatch, + unstableGitUpdater, + libnotify, +}: buildLua rec { pname = "mpv-notify-send"; @@ -19,19 +21,23 @@ buildLua rec { patches = [ # show title of online videos instead of url (fetchpatch { - url = "https://github.com/emilazy/mpv-notify-send/pull/6.patch"; + name = "6.patch"; # https://github.com/emilazy/mpv-notify-send/pull/6 + url = "https://github.com/emilazy/mpv-notify-send/commit/948347e14890e15e89cd1e069beb1140e2d01dce.patch"; hash = "sha256-7aXQ8qeqG4yX0Uyn09xCIESnwPZsb6Frd7C49XgbpFw="; }) ]; passthru.extraWrapperArgs = [ - "--prefix" "PATH" ":" (lib.makeBinPath libnotify) + "--prefix" + "PATH" + ":" + (lib.makeBinPath libnotify) ]; passthru.updateScript = unstableGitUpdater { }; meta = with lib; { - description = "A Lua script for mpv to send notifications with notify-send"; + description = "Lua script for mpv to send notifications with notify-send"; homepage = "https://github.com/emilazy/mpv-notify-send"; license = licenses.wtfpl; maintainers = with maintainers; [ r3n3gad3p3arl ]; diff --git a/pkgs/applications/video/mpv/scripts/mpv-osc-modern.nix b/pkgs/applications/video/mpv/scripts/mpv-osc-modern.nix index ce32622d64d8f..0d2c292d702a0 100644 --- a/pkgs/applications/video/mpv/scripts/mpv-osc-modern.nix +++ b/pkgs/applications/video/mpv/scripts/mpv-osc-modern.nix @@ -1,8 +1,9 @@ -{ lib -, buildLua -, fetchFromGitHub -, makeFontsConf -, nix-update-script +{ + lib, + buildLua, + fetchFromGitHub, + makeFontsConf, + nix-update-script, }: buildLua (finalAttrs: { pname = "mpv-osc-modern"; diff --git a/pkgs/applications/video/mpv/scripts/mpv-playlistmanager.nix b/pkgs/applications/video/mpv/scripts/mpv-playlistmanager.nix index 44f09b8f21fe8..00e44d1f94474 100644 --- a/pkgs/applications/video/mpv/scripts/mpv-playlistmanager.nix +++ b/pkgs/applications/video/mpv/scripts/mpv-playlistmanager.nix @@ -1,4 +1,10 @@ -{ lib, buildLua, fetchFromGitHub, unstableGitUpdater, yt-dlp }: +{ + lib, + buildLua, + fetchFromGitHub, + unstableGitUpdater, + yt-dlp, +}: buildLua rec { pname = "mpv-playlistmanager"; @@ -10,12 +16,12 @@ buildLua rec { rev = "1911dc053951169c98cfcfd9f44ef87d9122ca80"; hash = "sha256-pcdOMhkivLF5B86aNuHrqj77DuYLAFGlwFwY7jxkDkE="; }; - passthru.updateScript = unstableGitUpdater {}; + passthru.updateScript = unstableGitUpdater { }; postPatch = '' substituteInPlace playlistmanager.lua \ - --replace 'youtube_dl_executable = "youtube-dl",' \ - 'youtube_dl_executable = "${lib.getBin yt-dlp}/bin/yt-dlp"', + --replace-fail 'youtube_dl_executable = "yt-dlp",' \ + 'youtube_dl_executable = "${lib.getExe yt-dlp}"', ''; meta = with lib; { diff --git a/pkgs/applications/video/mpv/scripts/mpv-slicing.nix b/pkgs/applications/video/mpv/scripts/mpv-slicing.nix index cf66a6c78a297..c46388f7ebea4 100644 --- a/pkgs/applications/video/mpv/scripts/mpv-slicing.nix +++ b/pkgs/applications/video/mpv/scripts/mpv-slicing.nix @@ -26,7 +26,7 @@ buildLua { passthru.scriptName = "slicing.lua"; meta = { - description = "A lua script to cut fragments of the video in uncompressed RGB format"; + description = "Lua script to cut fragments of the video in uncompressed RGB format"; homepage = "https://github.com/Kagami/mpv_slicing"; license = lib.licenses.cc0; maintainers = with lib.maintainers; [ tomasajt ]; diff --git a/pkgs/applications/video/mpv/scripts/mpv-webm.nix b/pkgs/applications/video/mpv/scripts/mpv-webm.nix index efff9fa8ee169..409d86c193f42 100644 --- a/pkgs/applications/video/mpv/scripts/mpv-webm.nix +++ b/pkgs/applications/video/mpv/scripts/mpv-webm.nix @@ -1,19 +1,20 @@ -{ lib -, buildLua -, fetchFromGitHub -, luaPackages -, unstableGitUpdater +{ + lib, + buildLua, + fetchFromGitHub, + luaPackages, + unstableGitUpdater, }: buildLua { pname = "mpv-webm"; - version = "0-unstable-2024-04-22"; + version = "0-unstable-2024-05-13"; src = fetchFromGitHub { owner = "ekisu"; repo = "mpv-webm"; - rev = "225e8e53842f7da6f77034309c1e54293dc629a4"; - hash = "sha256-82xWiuOChxfzX6e0+cGFxTqyuiPefyVwpvLM5ka7nPk="; + rev = "8d4902b2aec92f40e4595ec9a411ab90488dcf4e"; + hash = "sha256-aPPVAZu9reDdyovSpDklYZYLaapKBclAx3lCYUMJt+w="; }; passthru.updateScript = unstableGitUpdater { # only "latest" tag pointing at HEAD diff --git a/pkgs/applications/video/mpv/scripts/mpv.nix b/pkgs/applications/video/mpv/scripts/mpv.nix index 06e9ccb4d74a8..ddf22e5dd03cf 100644 --- a/pkgs/applications/video/mpv/scripts/mpv.nix +++ b/pkgs/applications/video/mpv/scripts/mpv.nix @@ -1,24 +1,31 @@ -{ lib -, buildLua -, mpv-unwrapped +{ + lib, + buildLua, + mpv-unwrapped, }: -let mkBuiltin = name: args: - let srcPath = "TOOLS/lua/${name}.lua"; - in buildLua (lib.attrsets.recursiveUpdate rec { - inherit (mpv-unwrapped) src version; - pname = "mpv-${name}"; +let + mkBuiltin = + name: args: + let + srcPath = "TOOLS/lua/${name}.lua"; + in + buildLua ( + lib.attrsets.recursiveUpdate rec { + inherit (mpv-unwrapped) src version; + pname = "mpv-${name}"; - dontUnpack = true; - scriptPath = "${src}/${srcPath}"; + dontUnpack = true; + scriptPath = "${src}/${srcPath}"; - meta = with lib; { - inherit (mpv-unwrapped.meta) license; - homepage = "https://github.com/mpv-player/mpv/blob/v${version}/${srcPath}"; - }; - } args); - -in lib.mapAttrs (name: lib.makeOverridable (mkBuiltin name)) { + meta = with lib; { + inherit (mpv-unwrapped.meta) license; + homepage = "https://github.com/mpv-player/mpv/blob/v${version}/${srcPath}"; + }; + } args + ); +in +lib.mapAttrs (name: lib.makeOverridable (mkBuiltin name)) { acompressor.meta = { description = "Script to toggle and control ffmpeg's dynamic range compression filter."; maintainers = with lib.maintainers; [ nicoo ]; diff --git a/pkgs/applications/video/mpv/scripts/mpvacious.nix b/pkgs/applications/video/mpv/scripts/mpvacious.nix index adac4d1d60692..34776679aa257 100644 --- a/pkgs/applications/video/mpv/scripts/mpvacious.nix +++ b/pkgs/applications/video/mpv/scripts/mpvacious.nix @@ -1,33 +1,32 @@ -{ lib -, buildLua -, fetchFromGitHub -, gitUpdater -, curl -, wl-clipboard -, xclip +{ + lib, + buildLua, + fetchFromGitHub, + gitUpdater, + curl, + wl-clipboard, + xclip, }: buildLua rec { pname = "mpvacious"; - version = "0.33"; + version = "0.35"; src = fetchFromGitHub { owner = "Ajatt-Tools"; repo = "mpvacious"; rev = "v${version}"; - sha256 = "sha256-VHMXW2AzgX88EDnNshxo9Gh8mpXzRoTAq+58HKasUdo="; - }; - passthru.updateScript = gitUpdater { - rev-prefix = "v"; + sha256 = "sha256-LcO17zkGkXWqSjWPTA3cVwRnmSrhTlS3W4RhhYaKgY4="; }; + passthru.updateScript = gitUpdater { rev-prefix = "v"; }; postPatch = '' substituteInPlace utils/forvo.lua \ - --replace "'curl" "'${curl}/bin/curl" + --replace-fail "'curl" "'${lib.getExe curl}" substituteInPlace platform/nix.lua \ - --replace "'curl" "'${curl}/bin/curl" \ - --replace "'wl-copy" "'${wl-clipboard}/bin/wl-copy" \ - --replace "'xclip" "'${xclip}/bin/xclip" + --replace-fail "'curl" "'${lib.getExe curl}" \ + --replace-fail "'wl-copy" "'${lib.getExe' wl-clipboard "wl-copy"}" \ + --replace-fail "'xclip" "'${lib.getExe xclip}" ''; installPhase = '' diff --git a/pkgs/applications/video/mpv/scripts/occivink.nix b/pkgs/applications/video/mpv/scripts/occivink.nix index be3bdb07db8da..948a90c0d89b3 100644 --- a/pkgs/applications/video/mpv/scripts/occivink.nix +++ b/pkgs/applications/video/mpv/scripts/occivink.nix @@ -1,45 +1,49 @@ -{ lib -, fetchFromGitHub -, unstableGitUpdater -, buildLua +{ + lib, + fetchFromGitHub, + unstableGitUpdater, + buildLua, }: let - camelToKebab = let - inherit (lib.strings) match stringAsChars toLower; - isUpper = match "[A-Z]"; - in stringAsChars (c: if isUpper c != null then "-${toLower c}" else c); + 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: - let self = rec { - pname = camelToKebab name; - version = "0-unstable-2024-01-11"; - src = fetchFromGitHub { - owner = "occivink"; - repo = "mpv-scripts"; - rev = "d0390c8e802c2e888ff4a2e1d5e4fb040f855b89"; - hash = "sha256-pc2aaO7lZaoYMEXv5M0WI7PtmqgkNbdtNiLZZwVzppM="; - }; - passthru.updateScript = unstableGitUpdater {}; - - scriptPath = "scripts/${pname}.lua"; + mkScript = + name: args: + let + self = rec { + pname = camelToKebab name; + version = "0-unstable-2024-01-11"; + src = fetchFromGitHub { + owner = "occivink"; + repo = "mpv-scripts"; + rev = "d0390c8e802c2e888ff4a2e1d5e4fb040f855b89"; + hash = "sha256-pc2aaO7lZaoYMEXv5M0WI7PtmqgkNbdtNiLZZwVzppM="; + }; + passthru.updateScript = unstableGitUpdater { }; - meta = with lib; { - homepage = "https://github.com/occivink/mpv-scripts"; - license = licenses.unlicense; - maintainers = with maintainers; [ nicoo ]; - }; + scriptPath = "scripts/${pname}.lua"; - # Sadly needed to make `common-updaters` work here - pos = builtins.unsafeGetAttrPos "version" self; - }; - in buildLua (lib.attrsets.recursiveUpdate self args); + meta = with lib; { + homepage = "https://github.com/occivink/mpv-scripts"; + license = licenses.unlicense; + maintainers = with maintainers; [ nicoo ]; + }; + # Sadly needed to make `common-updaters` work here + pos = builtins.unsafeGetAttrPos "version" self; + }; + in + buildLua (lib.attrsets.recursiveUpdate self args); in lib.mapAttrs (name: lib.makeOverridable (mkScript name)) { # Usage: `pkgs.mpv.override { scripts = [ pkgs.mpvScripts.seekTo ]; }` seekTo.meta.description = "Mpv script for seeking to a specific position"; - blacklistExtensions.meta.description = - "Automatically remove playlist entries based on their extension."; + blacklistExtensions.meta.description = "Automatically remove playlist entries based on their extension."; } diff --git a/pkgs/applications/video/mpv/scripts/quack.nix b/pkgs/applications/video/mpv/scripts/quack.nix index 646a7a524d18f..a1b32f2911811 100644 --- a/pkgs/applications/video/mpv/scripts/quack.nix +++ b/pkgs/applications/video/mpv/scripts/quack.nix @@ -1,7 +1,9 @@ -{ lib -, fetchFromGitHub -, unstableGitUpdater -, buildLua }: +{ + lib, + fetchFromGitHub, + unstableGitUpdater, + buildLua, +}: buildLua rec { pname = "mpv-quack"; @@ -9,11 +11,11 @@ buildLua rec { version = "0-unstable-2020-05-27"; src = fetchFromGitHub { owner = "CounterPillow"; - repo = "mpv-quack"; - rev = "1c87f36f9726d462dd112188c04be54d85692cf3"; - hash = "sha256-dEnJbS8RJoAxpKINdoMHN4l7vpEdf7+C5JVWpK0VXMw="; + repo = "mpv-quack"; + rev = "1c87f36f9726d462dd112188c04be54d85692cf3"; + hash = "sha256-dEnJbS8RJoAxpKINdoMHN4l7vpEdf7+C5JVWpK0VXMw="; }; - passthru.updateScript = unstableGitUpdater {}; + passthru.updateScript = unstableGitUpdater { }; meta = { description = "Reduce audio volume after seeking"; diff --git a/pkgs/applications/video/mpv/scripts/quality-menu.nix b/pkgs/applications/video/mpv/scripts/quality-menu.nix index c75e810687132..36e5024b6aa8e 100644 --- a/pkgs/applications/video/mpv/scripts/quality-menu.nix +++ b/pkgs/applications/video/mpv/scripts/quality-menu.nix @@ -1,8 +1,9 @@ -{ lib -, buildLua -, fetchFromGitHub -, gitUpdater -, oscSupport ? false +{ + lib, + buildLua, + fetchFromGitHub, + gitUpdater, + oscSupport ? false, }: buildLua rec { @@ -15,14 +16,12 @@ buildLua rec { rev = "v${version}"; hash = "sha256-yrcTxqpLnOI1Tq3khhflO3wzhyeTPuvKifyH5/P57Ns="; }; - passthru.updateScript = gitUpdater { - rev-prefix = "v"; - }; + passthru.updateScript = gitUpdater { rev-prefix = "v"; }; extraScripts = lib.optional oscSupport "quality-menu-osc.lua"; meta = with lib; { - description = "A userscript for MPV that allows you to change youtube video quality (ytdl-format) on the fly"; + description = "Userscript for MPV that allows you to change youtube video quality (ytdl-format) on the fly"; homepage = "https://github.com/christoph-heinrich/mpv-quality-menu"; license = licenses.gpl2Only; maintainers = with maintainers; [ lunik1 ]; diff --git a/pkgs/applications/video/mpv/scripts/reload.nix b/pkgs/applications/video/mpv/scripts/reload.nix index 426aabd7fe495..b9d9b4c43b05d 100644 --- a/pkgs/applications/video/mpv/scripts/reload.nix +++ b/pkgs/applications/video/mpv/scripts/reload.nix @@ -1,7 +1,9 @@ -{ lib -, fetchFromGitHub -, unstableGitUpdater -, buildLua }: +{ + lib, + fetchFromGitHub, + unstableGitUpdater, + buildLua, +}: buildLua rec { pname = "mpv-reload"; @@ -9,11 +11,11 @@ buildLua rec { version = "0-unstable-2024-03-22"; src = fetchFromGitHub { owner = "4e6"; - repo = pname; - rev = "1a6a9383ba1774708fddbd976e7a9b72c3eec938"; - hash = "sha256-BshxCjec/UNGyiC0/g1Rai2NvG2qOIHXDDEUYwwdij0="; + repo = pname; + rev = "1a6a9383ba1774708fddbd976e7a9b72c3eec938"; + hash = "sha256-BshxCjec/UNGyiC0/g1Rai2NvG2qOIHXDDEUYwwdij0="; }; - passthru.updateScript = unstableGitUpdater {}; + passthru.updateScript = unstableGitUpdater { }; meta = { description = "Manual & automatic reloading of videos"; diff --git a/pkgs/applications/video/mpv/scripts/simple-mpv-webui.nix b/pkgs/applications/video/mpv/scripts/simple-mpv-webui.nix index bf973c9206c71..55d55fdf59f83 100644 --- a/pkgs/applications/video/mpv/scripts/simple-mpv-webui.nix +++ b/pkgs/applications/video/mpv/scripts/simple-mpv-webui.nix @@ -1,6 +1,8 @@ -{ lib, buildLua -, fetchFromGitHub -, gitUpdater +{ + lib, + buildLua, + fetchFromGitHub, + gitUpdater, }: buildLua rec { pname = "simple-mpv-ui"; @@ -11,19 +13,23 @@ buildLua rec { repo = "simple-mpv-webui"; rev = "v${version}"; hash = "sha256-I8lwpo3Hfpy3UnPMmHEJCdArVQnNL245NkxsYVmnMF0="; - sparseCheckout = [ "main.lua" "webui-page" ]; - }; - passthru.updateScript = gitUpdater { - rev-prefix = "v"; + sparseCheckout = [ + "main.lua" + "webui-page" + ]; }; + passthru.updateScript = gitUpdater { rev-prefix = "v"; }; scriptPath = "."; passthru.scriptName = "webui"; meta = with lib; { - description = "A web based user interface with controls for the mpv mediaplayer"; + description = "Web based user interface with controls for the mpv mediaplayer"; homepage = "https://github.com/open-dynaMIX/simple-mpv-webui"; - maintainers = with maintainers; [ cript0nauta zopieux ]; + maintainers = with maintainers; [ + cript0nauta + zopieux + ]; longDescription = '' You can access the webui when accessing http://127.0.0.1:8080 or http://[::1]:8080 in your webbrowser. By default it listens on diff --git a/pkgs/applications/video/mpv/scripts/sponsorblock-minimal.nix b/pkgs/applications/video/mpv/scripts/sponsorblock-minimal.nix index 2557db8313d6d..6818154590917 100644 --- a/pkgs/applications/video/mpv/scripts/sponsorblock-minimal.nix +++ b/pkgs/applications/video/mpv/scripts/sponsorblock-minimal.nix @@ -1,4 +1,11 @@ -{ lib, buildLua, fetchFromGitea, unstableGitUpdater, curl, coreutils }: +{ + lib, + buildLua, + fetchFromGitea, + unstableGitUpdater, + curl, + coreutils, +}: buildLua { pname = "mpv_sponsorblock_minimal"; @@ -21,8 +28,7 @@ buildLua { ''; meta = with lib; { - description = - "A minimal script to skip sponsored segments of YouTube videos"; + description = "Minimal script to skip sponsored segments of YouTube videos"; homepage = "https://codeberg.org/jouni/mpv_sponsorblock_minimal"; license = licenses.gpl3Only; platforms = platforms.all; diff --git a/pkgs/applications/video/mpv/scripts/sponsorblock.nix b/pkgs/applications/video/mpv/scripts/sponsorblock.nix index 56ac2575ecdea..16e8841abf5b6 100644 --- a/pkgs/applications/video/mpv/scripts/sponsorblock.nix +++ b/pkgs/applications/video/mpv/scripts/sponsorblock.nix @@ -1,4 +1,11 @@ -{ lib, buildLua, fetchFromGitHub, fetchpatch, python3, nix-update-script }: +{ + lib, + buildLua, + fetchFromGitHub, + fetchpatch, + python3, + nix-update-script, +}: # Usage: `pkgs.mpv.override { scripts = [ pkgs.mpvScripts.sponsorblock ]; }` buildLua { @@ -28,15 +35,13 @@ buildLua { postPatch = '' substituteInPlace sponsorblock.lua \ - --replace "python3" "${python3}/bin/python3" \ - --replace 'mp.find_config_file("scripts")' "\"$out/share/mpv/scripts\"" + --replace-fail "python3" "${lib.getExe python3}" \ + --replace-fail 'mp.find_config_file("scripts")' "\"$out/share/mpv/scripts\"" ''; extraScripts = [ "sponsorblock_shared" ]; - passthru.updateScript = nix-update-script { - extraArgs = [ "--version=branch" ]; - }; + passthru.updateScript = nix-update-script { extraArgs = [ "--version=branch" ]; }; meta = with lib; { description = "Script for mpv to skip sponsored segments of YouTube videos"; diff --git a/pkgs/applications/video/mpv/scripts/thumbfast.nix b/pkgs/applications/video/mpv/scripts/thumbfast.nix index e30c62774b759..158e1f38b32b3 100644 --- a/pkgs/applications/video/mpv/scripts/thumbfast.nix +++ b/pkgs/applications/video/mpv/scripts/thumbfast.nix @@ -1,4 +1,10 @@ -{ lib, fetchFromGitHub, unstableGitUpdater, buildLua, mpv-unwrapped }: +{ + lib, + fetchFromGitHub, + unstableGitUpdater, + buildLua, + mpv-unwrapped, +}: buildLua { pname = "mpv-thumbfast"; @@ -10,10 +16,13 @@ buildLua { rev = "03e93feee5a85bf7c65db953ada41b4826e9f905"; hash = "sha256-5u5WBvWOEydJrnr/vilEgW4+fxkxM6wNjb9Fyyxx/1c="; }; - passthru.updateScript = unstableGitUpdater {}; + passthru.updateScript = unstableGitUpdater { }; passthru.extraWrapperArgs = [ - "--prefix" "PATH" ":" "${lib.getBin mpv-unwrapped}/bin" + "--prefix" + "PATH" + ":" + (lib.makeBinPath [ mpv-unwrapped ]) ]; meta = { diff --git a/pkgs/applications/video/mpv/scripts/thumbnail.nix b/pkgs/applications/video/mpv/scripts/thumbnail.nix index 40c4fa8776d84..fc37b1a50dea8 100644 --- a/pkgs/applications/video/mpv/scripts/thumbnail.nix +++ b/pkgs/applications/video/mpv/scripts/thumbnail.nix @@ -1,16 +1,22 @@ -{ lib, buildLua, fetchFromGitHub, gitUpdater, python3 }: +{ + lib, + buildLua, + fetchFromGitHub, + gitUpdater, + python3, +}: buildLua rec { pname = "mpv-thumbnail-script"; - version = "0.5.3"; + version = "0.5.4"; src = fetchFromGitHub { owner = "marzzzello"; repo = "mpv_thumbnail_script"; rev = version; - sha256 = "sha256-J24Rou7BTE7zoiPlBkWuO9dtYJiuzkuwB4FROuzXzag="; + sha256 = "sha256-nflavx25skLj9kitneL6Uz3zI2DyMMhQC595npofzbQ="; }; - passthru.updateScript = gitUpdater {}; + passthru.updateScript = gitUpdater { }; nativeBuildInputs = [ python3 ]; postPatch = "patchShebangs concat_files.py"; @@ -21,7 +27,7 @@ buildLua rec { passthru.scriptName = "mpv_thumbnail_script_{client_osc,server}.lua"; meta = with lib; { - description = "A lua script to show preview thumbnails in mpv's OSC seekbar"; + description = "Lua script to show preview thumbnails in mpv's OSC seekbar"; homepage = "https://github.com/marzzzello/mpv_thumbnail_script"; changelog = "https://github.com/marzzzello/mpv_thumbnail_script/releases/tag/${version}"; license = licenses.gpl3Plus; diff --git a/pkgs/applications/video/mpv/scripts/uosc.nix b/pkgs/applications/video/mpv/scripts/uosc.nix index 61eb65f9bf9f3..45b359a42a83d 100644 --- a/pkgs/applications/video/mpv/scripts/uosc.nix +++ b/pkgs/applications/video/mpv/scripts/uosc.nix @@ -1,10 +1,10 @@ -{ lib -, fetchFromGitHub -, fetchpatch -, gitUpdater -, makeFontsConf -, buildLua -, buildGoModule +{ + lib, + fetchFromGitHub, + gitUpdater, + makeFontsConf, + buildLua, + buildGoModule, }: buildLua (finalAttrs: { @@ -18,7 +18,7 @@ buildLua (finalAttrs: { rev = finalAttrs.version; hash = "sha256-0GPDna9uOuhFDhA9A1fbkoKkgSB76qiDzJVQ9gjGcWo="; }; - passthru.updateScript = gitUpdater {}; + passthru.updateScript = gitUpdater { }; tools = buildGoModule { pname = "uosc-bin"; diff --git a/pkgs/applications/video/mpv/scripts/videoclip.nix b/pkgs/applications/video/mpv/scripts/videoclip.nix index fff5b788b0286..82f912677f14c 100644 --- a/pkgs/applications/video/mpv/scripts/videoclip.nix +++ b/pkgs/applications/video/mpv/scripts/videoclip.nix @@ -1,30 +1,33 @@ -{ lib -, fetchFromGitHub -, curl -, xclip -, wl-clipboard -, stdenv -, buildLua -, unstableGitUpdater +{ + lib, + fetchFromGitHub, + curl, + xclip, + wl-clipboard, + stdenv, + buildLua, + unstableGitUpdater, }: buildLua { pname = "videoclip"; - version = "0-unstable-2024-03-08"; + version = "0-unstable-2024-05-26"; src = fetchFromGitHub { owner = "Ajatt-Tools"; repo = "videoclip"; - rev = "0e3f2245b03e888c14c093a50261e0f54ecdf8e8"; - hash = "sha256-Sg6LHU9OVmVx3cTs8Y0WL8wACb5BlVyeBRccoX+7BXY="; + rev = "4fd40d66c95905ed828ca77b7120732014b93ac5"; + hash = "sha256-Q40a7BBY4c7I5g9HkeV6Twv/PDPBDKTlnxkILw99pxU="; }; - patchPhase = '' - substituteInPlace platform.lua \ - --replace \'curl\' \'${lib.getExe curl}\' \ - '' + lib.optionalString stdenv.isLinux '' - --replace xclip ${lib.getExe xclip} \ - --replace wl-copy ${lib.getExe' wl-clipboard "wl-copy"} - ''; + patchPhase = + '' + substituteInPlace platform.lua \ + --replace \'curl\' \'${lib.getExe curl}\' \ + '' + + lib.optionalString stdenv.isLinux '' + --replace xclip ${lib.getExe xclip} \ + --replace wl-copy ${lib.getExe' wl-clipboard "wl-copy"} + ''; scriptPath = "."; passthru.scriptName = "videoclip"; diff --git a/pkgs/applications/video/mpv/scripts/visualizer.nix b/pkgs/applications/video/mpv/scripts/visualizer.nix index 332604286847a..0308e6477d79f 100644 --- a/pkgs/applications/video/mpv/scripts/visualizer.nix +++ b/pkgs/applications/video/mpv/scripts/visualizer.nix @@ -14,11 +14,11 @@ buildLua { rev = "b4246984ba6dc6820adef5c8bbf793af85c9ab8e"; sha256 = "ZNUzw4OW7z+yGTxim7CCWJdWmihDFOQAQk3bC5Ijcbs="; }; - passthru.updateScript = unstableGitUpdater {}; + passthru.updateScript = unstableGitUpdater { }; meta = with lib; { description = "various audio visualization"; homepage = "https://github.com/mfcc64/mpv-scripts"; - maintainers = with maintainers; [kmein]; + maintainers = with maintainers; [ kmein ]; }; } diff --git a/pkgs/applications/video/mpv/scripts/vr-reversal.nix b/pkgs/applications/video/mpv/scripts/vr-reversal.nix index 9a7b335a6591d..6fb91e9ad780a 100644 --- a/pkgs/applications/video/mpv/scripts/vr-reversal.nix +++ b/pkgs/applications/video/mpv/scripts/vr-reversal.nix @@ -1,4 +1,10 @@ -{ lib, stdenvNoCC, fetchFromGitHub, gitUpdater, ffmpeg }: +{ + lib, + stdenvNoCC, + fetchFromGitHub, + gitUpdater, + ffmpeg, +}: stdenvNoCC.mkDerivation rec { pname = "vr-reversal"; @@ -10,15 +16,13 @@ stdenvNoCC.mkDerivation rec { rev = "v${version}"; sha256 = "1wn2ngcvn7wcsl3kmj782x5q9130qw951lj6ilrkafp6q6zscpqr"; }; - passthru.updateScript = gitUpdater { - rev-prefix = "v"; - }; + passthru.updateScript = gitUpdater { rev-prefix = "v"; }; dontBuild = true; # reset_rot is only available in ffmpeg 5.0, see 5bcc61ce87922ecccaaa0bd303a7e195929859a8 postPatch = lib.optionalString (lib.versionOlder ffmpeg.version "5.0") '' - substituteInPlace 360plugin.lua --replace ":reset_rot=1:" ":" + substituteInPlace 360plugin.lua --replace-fail ":reset_rot=1:" ":" ''; installPhase = '' @@ -29,7 +33,7 @@ stdenvNoCC.mkDerivation rec { passthru.scriptName = "360plugin.lua"; meta = with lib; { - description = "Script for mpv to play VR video with optional saving of head tracking data."; + description = "Script for mpv to play VR video with optional saving of head tracking data"; homepage = "https://github.com/dfaker/VR-reversal"; license = licenses.unlicense; platforms = platforms.all; diff --git a/pkgs/applications/video/mpv/scripts/webtorrent-mpv-hook.nix b/pkgs/applications/video/mpv/scripts/webtorrent-mpv-hook.nix index 10fe3d0cdce03..b423281a3ba38 100644 --- a/pkgs/applications/video/mpv/scripts/webtorrent-mpv-hook.nix +++ b/pkgs/applications/video/mpv/scripts/webtorrent-mpv-hook.nix @@ -1,4 +1,11 @@ -{ lib, buildNpmPackage, fetchFromGitHub, gitUpdater, nodejs, python3 }: +{ + lib, + buildNpmPackage, + fetchFromGitHub, + gitUpdater, + nodejs, + python3, +}: buildNpmPackage rec { pname = "webtorrent-mpv-hook"; @@ -10,14 +17,12 @@ buildNpmPackage rec { rev = "v${version}"; hash = "sha256-/dMtXcIyfAs++Zgz2CxRW0tkzn5QjS+WVGChlCyrU0U="; }; - passthru.updateScript = gitUpdater { - rev-prefix = "v"; - }; + passthru.updateScript = gitUpdater { rev-prefix = "v"; }; postPatch = '' - substituteInPlace src/webtorrent.ts --replace "node_path: 'node'" "node_path: '${nodejs}/bin/node'" + substituteInPlace src/webtorrent.ts --replace-fail "node_path: 'node'" "node_path: '${lib.getExe nodejs}'" # This executable is just for telling non-Nix users how to install - substituteInPlace package.json --replace '"bin": "build/bin.mjs",' "" + substituteInPlace package.json --replace-fail '"bin": "build/bin.mjs",' "" rm -rf src/bin.ts ''; diff --git a/pkgs/applications/video/mpv/scripts/youtube-upnext.nix b/pkgs/applications/video/mpv/scripts/youtube-upnext.nix index cdd7ea66a1763..ecd71353d6a3b 100644 --- a/pkgs/applications/video/mpv/scripts/youtube-upnext.nix +++ b/pkgs/applications/video/mpv/scripts/youtube-upnext.nix @@ -1,4 +1,10 @@ -{ buildLua, fetchFromGitHub, curl, unstableGitUpdater, lib }: +{ + buildLua, + fetchFromGitHub, + curl, + unstableGitUpdater, + lib, +}: buildLua rec { pname = "youtube-upnext"; @@ -13,13 +19,13 @@ buildLua rec { postPatch = '' substituteInPlace youtube-upnext.lua \ - --replace '"curl"' '"${lib.getExe curl}"' + --replace-fail '"curl"' '"${lib.getExe curl}"' ''; passthru.updateScript = unstableGitUpdater { }; meta = with lib; { - description = "A userscript that allows you to play 'up next'/recommended youtube videos"; + description = "Userscript that allows you to play 'up next'/recommended youtube videos"; homepage = "https://github.com/cvzi/mpv-youtube-upnext"; maintainers = with maintainers; [ bddvlpr ]; license = licenses.unfree; diff --git a/pkgs/applications/video/mpv/wrapper.nix b/pkgs/applications/video/mpv/wrapper.nix index b427318121ef0..533ede74f8744 100644 --- a/pkgs/applications/video/mpv/wrapper.nix +++ b/pkgs/applications/video/mpv/wrapper.nix @@ -7,21 +7,23 @@ , symlinkJoin , writeTextDir , yt-dlp +# the unwrapped mpv derivation +, mpv }: -# the unwrapped mpv derivation - 1st argument to `wrapMpv` -mpv: - let - # arguments to the function (exposed as `wrapMpv` in all-packages.nix) + # arguments to the function (exposed as `mpv-unwrapped.wrapper` in top-level) wrapper = { + mpv, extraMakeWrapperArgs ? [], youtubeSupport ? true, - # a set of derivations (probably from `mpvScripts`) where each is - # expected to have a `scriptName` passthru attribute that points to the - # name of the script that would reside in the script's derivation's + # a set of derivations (probably from `mpvScripts`) where each is 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. + # + # A script can optionally also provide `passthru.extraWrapperArgs` + # attribute. scripts ? [], extraUmpvWrapperArgs ? [] }: |