From b739397ae4f69118386e470adb77527fbc450efc Mon Sep 17 00:00:00 2001 From: Travis Whitaker Date: Fri, 18 May 2018 23:53:23 -0700 Subject: [PATCH 1/2] alacritty: Fix darwin. --- pkgs/applications/misc/alacritty/default.nix | 45 ++++++++++++++++++-- pkgs/top-level/all-packages.nix | 1 + 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/pkgs/applications/misc/alacritty/default.nix b/pkgs/applications/misc/alacritty/default.nix index 4a10d68ee4d..e3215e61a85 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; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1129a984d27..3edf567bfd7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -484,6 +484,7 @@ with pkgs; alacritty = callPackage ../applications/misc/alacritty { 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 { }; From a5b47bb3867380537bdbcb69b076679f457d6bb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Sat, 19 May 2018 12:23:47 +0100 Subject: [PATCH 2/2] alacritty: 2018-04-16 -> 2018-05-09 --- pkgs/applications/misc/alacritty/default.nix | 32 ++++++-------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/pkgs/applications/misc/alacritty/default.nix b/pkgs/applications/misc/alacritty/default.nix index e3215e61a85..e565b51cf50 100644 --- a/pkgs/applications/misc/alacritty/default.nix +++ b/pkgs/applications/misc/alacritty/default.nix @@ -50,18 +50,18 @@ let ]; in buildRustPackage rec { name = "alacritty-unstable-${version}"; - version = "2018-04-16"; + version = "2018-05-09"; # At the moment we cannot handle git dependencies in buildRustPackage. # This fork only replaces rust-fontconfig/libfontconfig with a git submodules. src = fetchgit { url = https://github.com/Mic92/alacritty.git; rev = "rev-${version}"; - sha256 = "14qsfaij631pk0gxrhmp594f72v0z7kzymf4hnqv4k5w9xlxciwx"; + sha256 = "0mgi4niy40zz80k2ammbzdw9d8flvfkwlxkjnbpwrrldd0sj8dlz"; fetchSubmodules = true; }; - cargoSha256 = "0gg28fbx0kisv7hqxgzqhv4z4ikk074djfjlj90nmmi4nddp017p"; + cargoSha256 = "0d6bqfnwqfxqllrf00p1djlxdvnhrahgnyqv842qjn94j3wf0fym"; nativeBuildInputs = [ cmake @@ -77,32 +77,20 @@ in buildRustPackage rec { --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 ""; + postBuild = lib.optionalString stdenv.isDarwin "make app"; installPhase = '' runHook preInstall install -D target/release/alacritty $out/bin/alacritty - ${patchRPathLibs} + '' + (if stdenv.isDarwin then '' + mkdir $out/Applications + cp -r target/release/osx/Alacritty.app $out/Applications/Alacritty.app + '' else '' install -D Alacritty.desktop $out/share/applications/alacritty.desktop - - ${copyDarwinApp} + patchelf --set-rpath "${stdenv.lib.makeLibraryPath rpathLibs}" $out/bin/alacritty + '') + '' runHook postInstall '';