about summary refs log tree commit diff
path: root/pkgs/applications/video
diff options
context:
space:
mode:
authorMario Rodas <marsam@users.noreply.github.com>2024-06-08 14:10:08 -0500
committerGitHub <noreply@github.com>2024-06-08 14:10:08 -0500
commitc95c1a563de84daa475f44bc7823601a24a12052 (patch)
tree1ade5d80bf139ecc2533223f7074e1fc9bfbfb0f /pkgs/applications/video
parent16cb1f38983d1d0977acacd7f042e9e05c7f9b06 (diff)
parent6ee4b2de1a5c9c77593a4d3cd23b46a4a1982c22 (diff)
downloadnixlib-c95c1a563de84daa475f44bc7823601a24a12052.tar
nixlib-c95c1a563de84daa475f44bc7823601a24a12052.tar.gz
nixlib-c95c1a563de84daa475f44bc7823601a24a12052.tar.bz2
nixlib-c95c1a563de84daa475f44bc7823601a24a12052.tar.lz
nixlib-c95c1a563de84daa475f44bc7823601a24a12052.tar.xz
nixlib-c95c1a563de84daa475f44bc7823601a24a12052.tar.zst
nixlib-c95c1a563de84daa475f44bc7823601a24a12052.zip
Merge pull request #304349 from atorres1985-contrib/mpv
mpv: 0.37.0 -> 0.38.0 
Diffstat (limited to 'pkgs/applications/video')
-rw-r--r--pkgs/applications/video/mpv/0001-fix-darwin-build.patch29
-rw-r--r--pkgs/applications/video/mpv/darwin-sigtool-no-deep.patch13
-rw-r--r--pkgs/applications/video/mpv/default.nix497
-rw-r--r--pkgs/applications/video/mpv/wrapper.nix18
4 files changed, 336 insertions, 221 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 000000000000..c7e486a3c5d1
--- /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 74ab97db4e54..000000000000
--- 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 ec2acb9656bb..b5672d7afa46 100644
--- a/pkgs/applications/video/mpv/default.nix
+++ b/pkgs/applications/video/mpv/default.nix
@@ -1,132 +1,177 @@
-{ lib
-, config
-, stdenv
-, fetchFromGitHub
-, 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,
+  nv-codec-headers-11,
+  openalSoft,
+  pipewire,
+  pkg-config,
+  python3,
+  rubberband,
+  shaderc, # instead of spirv-cross
+  speex,
+  stdenv,
+  swift,
+  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) {
+  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 "10.15";
+        hostPlatform = overrideSDK old.hostPlatform "10.15";
+        targetPlatform = overrideSDK old.targetPlatform "10.15";
+      })
+    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
     ''
   ];
 
@@ -135,81 +180,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
@@ -217,27 +305,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.
@@ -248,16 +338,19 @@ 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 { };
   };
 
   meta = {
@@ -271,7 +364,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/wrapper.nix b/pkgs/applications/video/mpv/wrapper.nix
index b427318121ef..533ede74f874 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 ? []
   }: