summary refs log tree commit diff
path: root/pkgs/applications/video/mpv/default.nix
diff options
context:
space:
mode:
authorStéphan Kochen <git@stephank.nl>2022-09-08 14:40:45 +0200
committerZhong Jianxin <azuwis@gmail.com>2023-02-28 11:10:17 +0800
commitf0a6216eebb3a6693b111e2927e10f520f6c479a (patch)
tree79e5c5a5122b154034d8d3dc3f60e3805bd57793 /pkgs/applications/video/mpv/default.nix
parenta51b9dc9f93bc6955f26f35c66d8929ab979aee9 (diff)
downloadnixpkgs-f0a6216eebb3a6693b111e2927e10f520f6c479a.tar
nixpkgs-f0a6216eebb3a6693b111e2927e10f520f6c479a.tar.gz
nixpkgs-f0a6216eebb3a6693b111e2927e10f520f6c479a.tar.bz2
nixpkgs-f0a6216eebb3a6693b111e2927e10f520f6c479a.tar.lz
nixpkgs-f0a6216eebb3a6693b111e2927e10f520f6c479a.tar.xz
nixpkgs-f0a6216eebb3a6693b111e2927e10f520f6c479a.tar.zst
nixpkgs-f0a6216eebb3a6693b111e2927e10f520f6c479a.zip
mpv: enable swift support
Diffstat (limited to 'pkgs/applications/video/mpv/default.nix')
-rw-r--r--pkgs/applications/video/mpv/default.nix12
1 files changed, 9 insertions, 3 deletions
diff --git a/pkgs/applications/video/mpv/default.nix b/pkgs/applications/video/mpv/default.nix
index 28e0d1d469a..59f7729b38a 100644
--- a/pkgs/applications/video/mpv/default.nix
+++ b/pkgs/applications/video/mpv/default.nix
@@ -66,7 +66,7 @@
 , sdl2Support        ? true,           SDL2
 , sixelSupport       ? false,          libsixel
 , speexSupport       ? true,           speex
-, swiftSupport       ? false,          swift
+, swiftSupport       ? stdenv.isDarwin, swift
 , theoraSupport      ? true,           libtheora
 , vaapiSupport       ? stdenv.isLinux, libva
 , vapoursynthSupport ? false,          vapoursynth
@@ -78,7 +78,7 @@
 }:
 
 let
-  inherit (darwin.apple_sdk.frameworks) CoreFoundation Cocoa CoreAudio MediaPlayer;
+  inherit (darwin.apple_sdk.frameworks) AVFoundation CoreFoundation CoreMedia Cocoa CoreAudio MediaPlayer;
   luaEnv = lua.withPackages (ps: with ps; [ luasocket ]);
 in stdenv.mkDerivation (self: {
   pname = "mpv";
@@ -99,6 +99,11 @@ in stdenv.mkDerivation (self: {
 
   NIX_LDFLAGS = lib.optionalString x11Support "-lX11 -lXext ";
 
+  preConfigure = lib.optionalString swiftSupport ''
+    # Ensure we reference 'lib' (not 'out') of Swift.
+    export SWIFT_LIB_DYNAMIC=${lib.getLib swift.swift}/lib/swift/macosx
+  '';
+
   mesonFlags = [
     (lib.mesonOption "default_library" "shared")
     (lib.mesonBool "libmpv" true)
@@ -167,7 +172,8 @@ in stdenv.mkDerivation (self: {
     ++ lib.optionals zimgSupport        [ zimg ]
     ++ lib.optionals stdenv.isLinux     [ nv-codec-headers ]
     ++ lib.optionals stdenv.isDarwin    [ libiconv ]
-    ++ lib.optionals stdenv.isDarwin    [ CoreFoundation Cocoa CoreAudio MediaPlayer ];
+    ++ lib.optionals stdenv.isDarwin    [ CoreFoundation Cocoa CoreAudio MediaPlayer ]
+    ++ 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