alacritty: Fix darwin.

This commit is contained in:
Travis Whitaker 2018-05-18 23:53:23 -07:00
parent 0edbc54b4f
commit b739397ae4
2 changed files with 42 additions and 4 deletions

View File

@ -1,4 +1,5 @@
{ stdenv, { stdenv,
lib,
fetchgit, fetchgit,
rustPlatform, rustPlatform,
cmake, cmake,
@ -14,7 +15,15 @@
libXi, libXi,
libXrandr, libXrandr,
libGL, libGL,
xclip }: xclip,
# Darwin Frameworks
AppKit,
CoreFoundation,
CoreGraphics,
CoreServices,
CoreText,
Foundation,
OpenGL }:
with rustPlatform; with rustPlatform;
@ -30,6 +39,15 @@ let
libGL libGL
libXi libXi
]; ];
darwinFrameworks = [
AppKit
CoreFoundation
CoreGraphics
CoreServices
CoreText
Foundation
OpenGL
];
in buildRustPackage rec { in buildRustPackage rec {
name = "alacritty-unstable-${version}"; name = "alacritty-unstable-${version}";
version = "2018-04-16"; version = "2018-04-16";
@ -51,21 +69,41 @@ in buildRustPackage rec {
pkgconfig pkgconfig
]; ];
buildInputs = rpathLibs; buildInputs = rpathLibs
++ lib.optionals stdenv.isDarwin darwinFrameworks;
postPatch = '' postPatch = ''
substituteInPlace copypasta/src/x11.rs \ substituteInPlace copypasta/src/x11.rs \
--replace Command::new\(\"xclip\"\) Command::new\(\"${xclip}/bin/xclip\"\) --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 = '' installPhase = ''
runHook preInstall runHook preInstall
install -D target/release/alacritty $out/bin/alacritty 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 install -D Alacritty.desktop $out/share/applications/alacritty.desktop
${copyDarwinApp}
runHook postInstall runHook postInstall
''; '';
@ -76,6 +114,5 @@ in buildRustPackage rec {
homepage = https://github.com/jwilm/alacritty; homepage = https://github.com/jwilm/alacritty;
license = with licenses; [ asl20 ]; license = with licenses; [ asl20 ];
maintainers = with maintainers; [ mic92 ]; maintainers = with maintainers; [ mic92 ];
platforms = platforms.linux;
}; };
} }

View File

@ -484,6 +484,7 @@ with pkgs;
alacritty = callPackage ../applications/misc/alacritty { alacritty = callPackage ../applications/misc/alacritty {
inherit (xorg) libXcursor libXxf86vm libXi; inherit (xorg) libXcursor libXxf86vm libXi;
inherit (darwin.apple_sdk.frameworks) AppKit CoreFoundation CoreGraphics CoreServices CoreText Foundation OpenGL;
}; };
amazon-glacier-cmd-interface = callPackage ../tools/backup/amazon-glacier-cmd-interface { }; amazon-glacier-cmd-interface = callPackage ../tools/backup/amazon-glacier-cmd-interface { };