summary refs log tree commit diff
path: root/pkgs/applications/misc/alacritty
diff options
context:
space:
mode:
authorTravis Whitaker <pi.boy.travis@gmail.com>2018-05-18 23:53:23 -0700
committerTravis Whitaker <pi.boy.travis@gmail.com>2018-05-19 00:01:47 -0700
commitb739397ae4f69118386e470adb77527fbc450efc (patch)
tree063531d4896498cfc48a9ad7f24b188dd1c77913 /pkgs/applications/misc/alacritty
parent0edbc54b4f0429275b24e54cf51f01b0bf8bea25 (diff)
downloadnixlib-b739397ae4f69118386e470adb77527fbc450efc.tar
nixlib-b739397ae4f69118386e470adb77527fbc450efc.tar.gz
nixlib-b739397ae4f69118386e470adb77527fbc450efc.tar.bz2
nixlib-b739397ae4f69118386e470adb77527fbc450efc.tar.lz
nixlib-b739397ae4f69118386e470adb77527fbc450efc.tar.xz
nixlib-b739397ae4f69118386e470adb77527fbc450efc.tar.zst
nixlib-b739397ae4f69118386e470adb77527fbc450efc.zip
alacritty: Fix darwin.
Diffstat (limited to 'pkgs/applications/misc/alacritty')
-rw-r--r--pkgs/applications/misc/alacritty/default.nix45
1 files changed, 41 insertions, 4 deletions
diff --git a/pkgs/applications/misc/alacritty/default.nix b/pkgs/applications/misc/alacritty/default.nix
index 4a10d68ee4dc..e3215e61a85f 100644
--- a/pkgs/applications/misc/alacritty/default.nix
+++ b/pkgs/applications/misc/alacritty/default.nix
@@ -1,4 +1,5 @@
 { stdenv,
+  lib,
   fetchgit,
   rustPlatform,
   cmake,
@@ -14,7 +15,15 @@
   libXi,
   libXrandr,
   libGL,
-  xclip }:
+  xclip,
+  # Darwin Frameworks
+  AppKit,
+  CoreFoundation,
+  CoreGraphics,
+  CoreServices,
+  CoreText,
+  Foundation,
+  OpenGL }:
 
 with rustPlatform;
 
@@ -30,6 +39,15 @@ let
     libGL
     libXi
   ];
+  darwinFrameworks = [
+    AppKit
+    CoreFoundation
+    CoreGraphics
+    CoreServices
+    CoreText
+    Foundation
+    OpenGL
+  ];
 in buildRustPackage rec {
   name = "alacritty-unstable-${version}";
   version = "2018-04-16";
@@ -51,21 +69,41 @@ in buildRustPackage rec {
     pkgconfig
   ];
 
-  buildInputs = rpathLibs;
+  buildInputs = rpathLibs
+             ++ lib.optionals stdenv.isDarwin darwinFrameworks;
 
   postPatch = ''
     substituteInPlace copypasta/src/x11.rs \
       --replace Command::new\(\"xclip\"\) Command::new\(\"${xclip}/bin/xclip\"\)
   '';
 
+  postBuild = if stdenv.isDarwin
+    then ''
+      make app
+    ''
+    else "";
+
+  patchRPathLibs = if stdenv.isDarwin then "" else ''
+    patchelf --set-rpath "${stdenv.lib.makeLibraryPath rpathLibs}" $out/bin/alacritty
+  '';
+
+  copyDarwinApp = if stdenv.isDarwin
+    then ''
+      mkdir $out/Applications
+      cp -r target/release/osx/Alacritty.app $out/Applications/Alacritty.app
+    ''
+    else "";
+
   installPhase = ''
     runHook preInstall
 
     install -D target/release/alacritty $out/bin/alacritty
-    patchelf --set-rpath "${stdenv.lib.makeLibraryPath rpathLibs}" $out/bin/alacritty
+    ${patchRPathLibs}
 
     install -D Alacritty.desktop $out/share/applications/alacritty.desktop
 
+    ${copyDarwinApp}
+
     runHook postInstall
   '';
 
@@ -76,6 +114,5 @@ in buildRustPackage rec {
     homepage = https://github.com/jwilm/alacritty;
     license = with licenses; [ asl20 ];
     maintainers = with maintainers; [ mic92 ];
-    platforms = platforms.linux;
   };
 }