summary refs log tree commit diff
path: root/pkgs/os-specific/darwin
diff options
context:
space:
mode:
authorDaiderd Jordan <daiderd@gmail.com>2020-02-06 14:15:35 +0100
committerDaiderd Jordan <daiderd@gmail.com>2020-02-06 14:15:35 +0100
commit3987ea9a9d4464869ac6b8e8519a386190b6b68d (patch)
tree97bb839f5443e5594c79ff3859caa281fca4d392 /pkgs/os-specific/darwin
parentf8a38f67bdec6de2978e1215a807035dc6960d4b (diff)
downloadnixpkgs-3987ea9a9d4464869ac6b8e8519a386190b6b68d.tar
nixpkgs-3987ea9a9d4464869ac6b8e8519a386190b6b68d.tar.gz
nixpkgs-3987ea9a9d4464869ac6b8e8519a386190b6b68d.tar.bz2
nixpkgs-3987ea9a9d4464869ac6b8e8519a386190b6b68d.tar.lz
nixpkgs-3987ea9a9d4464869ac6b8e8519a386190b6b68d.tar.xz
nixpkgs-3987ea9a9d4464869ac6b8e8519a386190b6b68d.tar.zst
nixpkgs-3987ea9a9d4464869ac6b8e8519a386190b6b68d.zip
mpv: add flag for swift on darwin
While we currently don't have a pure swift build on macOS it's possible
to build mpv using the swift compiler from CLT. eg.

    self: super:
    let
      CommandLineTools = "/Library/Developer/CommandLineTools";
    in
    {
      swift = super.stdenv.mkDerivation {
        name = "swift-CommandLineTools-0.0.0";
        phases = [ "installPhase" "fixupPhase" ];

        propagatedBuildInputs = [ self.darwin.DarwinTools ];

        installPhase = ''
            mkdir -p $out/bin $out/lib
            ln -s ${CommandLineTools}/usr/bin/swift $out/bin
            ln -s ${CommandLineTools}/usr/lib/swift $out/lib
            ln -s ${CommandLineTools}/SDKs $out
        '';

        setupHook = builtins.toFile "hook" ''
            addCommandLineTools() {
                echo >&2
                echo "WARNING: this is impure and unreliable, make sure the CommandLineTools are installed!" >&2
                echo "  $ xcode-select --install" >&2
                echo >&2
                [ -d ${CommandLineTools} ]
                export NIX_LDFLAGS+=" -L@out@/lib/swift/macosx"
                export SWIFT=swift
                export SWIFT_LIB_DYNAMIC=@out@/lib/swift/macosx
                export MACOS_SDK_VERSION=$(sw_vers -productVersion | awk -F. '{print $1 "." $2}')
                export MACOS_SDK=@out@/SDKs/MacOSX$MACOS_SDK_VERSION.sdk
            }

            prePhases+=" addCommandLineTools"
        '';

        __impureHostDeps = [ CommandLineTools ];
      };

      mpv = super.mpv.override { swiftSupport = true; };
    }
Diffstat (limited to 'pkgs/os-specific/darwin')
-rw-r--r--pkgs/os-specific/darwin/apple-sdk/frameworks.nix1
1 files changed, 1 insertions, 0 deletions
diff --git a/pkgs/os-specific/darwin/apple-sdk/frameworks.nix b/pkgs/os-specific/darwin/apple-sdk/frameworks.nix
index 09e0e4e48ec..02e2421f347 100644
--- a/pkgs/os-specific/darwin/apple-sdk/frameworks.nix
+++ b/pkgs/os-specific/darwin/apple-sdk/frameworks.nix
@@ -75,6 +75,7 @@ with frameworks; with libs; {
   LocalAuthentication     = [];
   MapKit                  = [];
   MediaAccessibility      = [ CoreGraphics CoreText QuartzCore ];
+  MediaPlayer             = [];
   MediaToolbox            = [ AudioToolbox AudioUnit CoreMedia ];
   Metal                   = [];
   MetalKit                = [ ModelIO Metal ];