diff options
author | Jude Taylor <me@jude.bio> | 2015-06-20 15:29:42 -0700 |
---|---|---|
committer | Jude Taylor <me@jude.bio> | 2015-06-20 15:29:55 -0700 |
commit | a4fbe26ec808c139c1cba8676095645dcbdde5f7 (patch) | |
tree | 0a1c2a81664b78cc01e5b20a8619bda8e210cfc8 | |
parent | 507bb016cc1acb39f1a913b60a5c5241157ce45b (diff) | |
download | nixlib-a4fbe26ec808c139c1cba8676095645dcbdde5f7.tar nixlib-a4fbe26ec808c139c1cba8676095645dcbdde5f7.tar.gz nixlib-a4fbe26ec808c139c1cba8676095645dcbdde5f7.tar.bz2 nixlib-a4fbe26ec808c139c1cba8676095645dcbdde5f7.tar.lz nixlib-a4fbe26ec808c139c1cba8676095645dcbdde5f7.tar.xz nixlib-a4fbe26ec808c139c1cba8676095645dcbdde5f7.tar.zst nixlib-a4fbe26ec808c139c1cba8676095645dcbdde5f7.zip |
darwin purity: haskell-hfsevents
-rw-r--r-- | pkgs/development/haskell-modules/configuration-common.nix | 6 | ||||
-rw-r--r-- | pkgs/os-specific/darwin/apple-sdk/default.nix | 150 | ||||
-rw-r--r-- | pkgs/os-specific/darwin/apple-sdk/frameworks.nix | 119 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 2 |
4 files changed, 276 insertions, 1 deletions
diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index 751e0fb4825b..32098b0c7dbe 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -192,7 +192,11 @@ self: super: { # cabal2nix likes to generate dependencies on hinotify when hfsevents is really required # on darwin: https://github.com/NixOS/cabal2nix/issues/146 - hinotify = if pkgs.stdenv.isDarwin then super.hfsevents else super.hinotify; + hinotify = if pkgs.stdenv.isDarwin then self.hfsevents else super.hinotify; + + hfsevents = if pkgs.stdenv.isDarwin + then addBuildTool super.hfsevents pkgs.darwin.apple_sdk.frameworks.CoreServices + else super.hfsevents; # FSEvents API is very buggy and tests are unreliable. See # http://openradar.appspot.com/10207999 and similar issues diff --git a/pkgs/os-specific/darwin/apple-sdk/default.nix b/pkgs/os-specific/darwin/apple-sdk/default.nix new file mode 100644 index 000000000000..520158b30add --- /dev/null +++ b/pkgs/os-specific/darwin/apple-sdk/default.nix @@ -0,0 +1,150 @@ +{ stdenv, fetchurl, xar, gzip, cpio }: + +let + # I'd rather not "export" this, since they're somewhat monolithic and encourage bad habits. + # Also, the include directory inside here should be captured (almost?) entirely by our more + # precise Apple package structure, so with any luck it's unnecessary. + sdk = stdenv.mkDerivation rec { + version = "10.9"; + name = "MacOS_SDK-${version}"; + + src = fetchurl { + url = "http://swcdn.apple.com/content/downloads/27/02/031-06182/xxog8vxu8i6af781ivf4uhy6yt1lslex34/DevSDK_OSX109.pkg"; + sha256 = "16b7aplha5573yl1d44nl2yxzp0w2hafihbyh7930wrcvba69iy4"; + }; + + buildInputs = [ xar gzip cpio ]; + + phases = [ "unpackPhase" "installPhase" "fixupPhase" ]; + + unpackPhase = '' + xar -x -f $src + ''; + + installPhase = '' + start="$(pwd)" + mkdir -p $out + cd $out + cat $start/Payload | gzip -d | cpio -idm + + mv usr/* . + rmdir usr + + mv System/* . + rmdir System + + cd Library/Frameworks/QuartzCore.framework/Versions/A/Headers + for file in CI*.h; do + rm $file + ln -s ../Frameworks/CoreImage.framework/Versions/A/Headers/$file + done + ''; + + meta = with stdenv.lib; { + description = "Apple SDK ${version}"; + maintainers = with maintainers; [ copumpkin ]; + platforms = platforms.darwin; + }; + }; + + framework = name: deps: stdenv.mkDerivation { + name = "apple-framework-${name}"; + + phases = [ "installPhase" "fixupPhase" ]; + + installPhase = '' + linkFramework() { + local path="$1" + local dest="$out/Library/Frameworks/$path" + local name="$(basename "$path" .framework)" + local current="$(readlink "/System/Library/Frameworks/$path/Versions/Current")" + + mkdir -p "$dest" + pushd "$dest" >/dev/null + + ln -s "${sdk}/Library/Frameworks/$path/Versions/$current/Headers" + ln -s -L "/System/Library/Frameworks/$path/Versions/$current/$name" + ln -s -L "/System/Library/Frameworks/$path/Versions/$current/Resources" + + if [ -f "/System/Library/Frameworks/$path/module.map" ]; then + ln -s "/System/Library/Frameworks/$path/module.map" + fi + + pushd "${sdk}/Library/Frameworks/$path/Versions/$current" >/dev/null + local children=$(echo Frameworks/*.framework) + popd >/dev/null + + for child in $children; do + childpath="$path/Versions/$current/$child" + linkFramework "$childpath" + done + + if [ -d "$dest/Versions/$current" ]; then + mv $dest/Versions/$current/* . + fi + + popd >/dev/null + } + + linkFramework "${name}.framework" + ''; + + propagatedBuildInputs = deps; + + # Not going to bother being more precise than this... + __propagatedImpureHostDeps = [ "/System/Library/Frameworks/${name}.framework/Versions" ]; + + meta = with stdenv.lib; { + description = "Apple SDK framework ${name}"; + maintainers = with maintainers; [ copumpkin ]; + platforms = platforms.darwin; + }; + }; +in rec { + libs = { + xpc = stdenv.mkDerivation { + name = "apple-lib-xpc"; + phases = [ "installPhase" "fixupPhase" ]; + + installPhase = '' + mkdir -p $out/include + pushd $out/include >/dev/null + ln -s "${sdk}/include/xpc" + popd >/dev/null + ''; + }; + + Xplugin = stdenv.mkDerivation { + name = "apple-lib-Xplugin"; + phases = [ "installPhase" "fixupPhase" ]; + + # Not enough + __propagatedImpureHostDeps = [ "/usr/lib/libXplugin.1.dylib" ]; + + propagatedBuildInputs = with frameworks; [ + OpenGL ApplicationServices Carbon IOKit CoreFoundation CoreGraphics CoreServices CoreText + ]; + + installPhase = '' + mkdir -p $out/include $out/lib + ln -s "${sdk}/include/Xplugin.h" $out/include/Xplugin.h + ln -s "/usr/lib/libXplugin.1.dylib" $out/lib/libXplugin.dylib + ''; + }; + + utmp = stdenv.mkDerivation { + name = "apple-lib-utmp"; + phases = [ "installPhase" "fixupPhase" ]; + + installPhase = '' + mkdir -p $out/include + pushd $out/include >/dev/null + ln -s "${sdk}/include/utmp.h" + ln -s "${sdk}/include/utmpx.h" + popd >/dev/null + ''; + }; + }; + + frameworks = stdenv.lib.mapAttrs framework (import ./frameworks.nix { inherit frameworks libs; }); +} diff --git a/pkgs/os-specific/darwin/apple-sdk/frameworks.nix b/pkgs/os-specific/darwin/apple-sdk/frameworks.nix new file mode 100644 index 000000000000..60ed091a1e41 --- /dev/null +++ b/pkgs/os-specific/darwin/apple-sdk/frameworks.nix @@ -0,0 +1,119 @@ +# Current as of 10.9 +# Epic weird knot-tying happening here. +# TODO: clean up the process for generating this and include it + +{ frameworks, libs }: + +with frameworks; with libs; { + AGL = [ Carbon OpenGL ]; + AVFoundation = [ ApplicationServices CoreGraphics ]; + AVKit = []; + Accounts = []; + AddressBook = [ Carbon CoreFoundation ]; + AppKit = [ QuartzCore ]; + AppKitScripting = []; + AppleScriptKit = []; + AppleScriptObjC = []; + AppleShareClientCore = [ CoreServices ]; + AudioToolbox = [ AudioUnit CoreAudio CoreFoundation CoreMIDI ]; + AudioUnit = [ Carbon CoreAudio CoreFoundation ]; + AudioVideoBridging = [ Foundation ]; + Automator = []; + CFNetwork = [ CoreFoundation ]; + CalendarStore = []; + Cocoa = []; + Collaboration = []; + CoreAudio = [ CoreFoundation IOKit ]; + CoreAudioKit = [ AudioUnit ]; + CoreData = []; + CoreFoundation = []; + CoreGraphics = [ CoreFoundation IOKit IOSurface ]; + CoreLocation = []; + CoreMIDI = [ CoreFoundation ]; + CoreMIDIServer = []; + CoreMedia = [ ApplicationServices AudioToolbox CoreAudio CoreFoundation CoreGraphics CoreVideo ]; + CoreMediaIO = [ CoreFoundation CoreMedia ]; + CoreText = [ CoreFoundation CoreGraphics ]; + CoreVideo = [ ApplicationServices CoreFoundation CoreGraphics IOSurface OpenGL ]; + CoreWLAN = []; + DVComponentGlue = [ CoreServices QuickTime ]; + DVDPlayback = []; + DirectoryService = [ CoreFoundation ]; + DiscRecording = [ CoreFoundation CoreServices IOKit ]; + DiscRecordingUI = []; + DiskArbitration = [ CoreFoundation IOKit ]; + DrawSprocket = [ Carbon ]; + EventKit = []; + ExceptionHandling = []; + FWAUserLib = []; + ForceFeedback = [ CoreFoundation IOKit ]; + Foundation = [ CoreFoundation Security ApplicationServices AppKit ]; + GLKit = [ CoreFoundation ]; + GLUT = [ GL OpenGL ]; + GSS = []; + GameController = []; + GameKit = [ Foundation ]; + ICADevices = [ Carbon CoreFoundation IOBluetooth ]; + IMServicePlugIn = []; + IOBluetoothUI = [ IOBluetooth ]; + IOKit = [ CoreFoundation ]; + IOSurface = [ CoreFoundation IOKit xpc ]; + ImageCaptureCore = []; + ImageIO = [ CoreFoundation CoreGraphics ]; + InputMethodKit = [ Carbon ]; + InstallerPlugins = []; + InstantMessage = []; + JavaFrameEmbedding = []; + JavaScriptCore = [ CoreFoundation ]; + Kerberos = []; + Kernel = [ CoreFoundation IOKit ]; + LDAP = []; + LatentSemanticMapping = [ Carbon CoreFoundation ]; + MapKit = []; + MediaAccessibility = [ CoreFoundation CoreGraphics CoreText QuartzCore ]; + MediaToolbox = [ AudioToolbox CoreFoundation CoreMedia ]; + NetFS = [ CoreFoundation ]; + OSAKit = [ Carbon ]; + OpenAL = []; + OpenCL = [ CL IOSurface OpenGL ]; + OpenGL = []; + PCSC = []; + PreferencePanes = []; + PubSub = []; + Python = [ ApplicationServices ]; + QTKit = [ QuickTime ]; + QuickLook = [ ApplicationServices CoreFoundation ]; + QuickTime = [ ApplicationServices AudioUnit Carbon CoreAudio CoreServices OpenGL QuartzCore ]; + Ruby = []; + RubyCocoa = []; + SceneKit = []; + ScreenSaver = []; + Scripting = []; + ScriptingBridge = []; + Security = [ CoreFoundation ]; + SecurityFoundation = []; + SecurityInterface = [ Security ]; + ServiceManagement = [ CoreFoundation Security ]; + Social = []; + SpriteKit = []; + StoreKit = []; + SyncServices = []; + SystemConfiguration = [ CoreFoundation Security ]; + TWAIN = [ Carbon ]; + Tcl = []; + Tk = [ ApplicationServices Carbon X11 ]; + VideoDecodeAcceleration = [ CoreFoundation CoreVideo ]; + VideoToolbox = [ CoreFoundation CoreMedia CoreVideo ]; + WebKit = [ ApplicationServices Carbon JavaScriptCore OpenGL X11 ]; + + # Umbrellas + Accelerate = [ CoreGraphics ]; + ApplicationServices = [ CoreFoundation CoreServices CoreText ImageIO ]; + Carbon = [ ApplicationServices CoreFoundation CoreServices IOKit Security ]; + CoreServices = [ CFNetwork CoreFoundation DiskArbitration Security ]; + IOBluetooth = [ IOKit ]; + JavaVM = []; + OpenDirectory = [ CoreFoundation Foundation ]; + Quartz = [ QuickLook ]; + QuartzCore = [ ApplicationServices CoreFoundation CoreVideo ]; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 2cd659a5e75f..8daac14761f5 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9235,6 +9235,8 @@ let cmdline_sdk = cmdline.sdk; cmdline_tools = cmdline.tools; + apple_sdk = callPackage ../os-specific/darwin/apple-sdk {}; + libobjc = apple-source-releases.objc4; }; |