Skip to content

Commit

Permalink
mpv: use wrapped bundle executable on Darwin
Browse files Browse the repository at this point in the history
On macOS, many things won’t work properly unless mpv is executed from
the app bundle, such as spatial audio with `--ao=avfoundation`. This
ensures that those features work reliably and also avoids duplicating
the entire `mpv` binary.
  • Loading branch information
emilazy committed Oct 23, 2024
1 parent 8db2730 commit 888c460
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkgs/applications/video/mpv/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
libvdpau,
libxkbcommon,
lua,
makeWrapper,
mesa,
meson,
mujs,
Expand Down Expand Up @@ -153,6 +154,7 @@ stdenv.mkDerivation (finalAttrs: {
++ lib.optionals stdenv.hostPlatform.isDarwin [
buildPackages.darwin.sigtool
swift
makeWrapper
]
++ lib.optionals waylandSupport [ wayland-scanner ];

Expand Down Expand Up @@ -245,6 +247,13 @@ stdenv.mkDerivation (finalAttrs: {
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p $out/Applications
cp -r mpv.app $out/Applications
# On macOS, many things won’t work properly unless `mpv(1)` is
# executed from the app bundle, such as spatial audio with
# `--ao=avfoundation`. This wrapper ensures that those features
# work reliably and also avoids shipping two copies of the entire
# `mpv` executable.
makeWrapper $out/Applications/mpv.app/Contents/MacOS/mpv $out/bin/mpv
'';

# Set RUNPATH so that libcuda in /run/opengl-driver(-32)/lib can be found.
Expand Down

0 comments on commit 888c460

Please sign in to comment.