2020-10-15 19:05:13 +11:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, rustPlatform
|
|
|
|
|
|
|
|
, cmake
|
|
|
|
, gzip
|
|
|
|
, installShellFiles
|
|
|
|
, makeWrapper
|
|
|
|
, ncurses
|
|
|
|
, pkgconfig
|
|
|
|
, python3
|
|
|
|
|
|
|
|
, expat
|
|
|
|
, fontconfig
|
|
|
|
, freetype
|
|
|
|
, libGL
|
|
|
|
, libX11
|
|
|
|
, libXcursor
|
|
|
|
, libXi
|
|
|
|
, libXrandr
|
|
|
|
, libXxf86vm
|
|
|
|
, libxcb
|
|
|
|
, libxkbcommon
|
|
|
|
, wayland
|
|
|
|
, xdg_utils
|
|
|
|
|
|
|
|
# Darwin Frameworks
|
|
|
|
, AppKit
|
|
|
|
, CoreGraphics
|
|
|
|
, CoreServices
|
|
|
|
, CoreText
|
|
|
|
, Foundation
|
|
|
|
, OpenGL
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
rpathLibs = [
|
|
|
|
expat
|
|
|
|
fontconfig
|
|
|
|
freetype
|
|
|
|
stdenv.cc.cc.lib # libstdc++.so.6
|
|
|
|
libGL
|
|
|
|
libX11
|
|
|
|
libXcursor
|
|
|
|
libXi
|
|
|
|
libXrandr
|
|
|
|
libXxf86vm
|
|
|
|
libxcb
|
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
|
|
libxkbcommon
|
|
|
|
wayland
|
|
|
|
];
|
|
|
|
triple =
|
|
|
|
if stdenv.isLinux
|
|
|
|
then "${stdenv.platform.kernelArch}-unknown-linux-gnu"
|
|
|
|
else "x86_64-apple-darwin";
|
|
|
|
in
|
|
|
|
|
|
|
|
# https://github.com/alacritty/alacritty/issues/4049#issuecomment-665664761
|
|
|
|
assert builtins.compareVersions rustPlatform.rust.rustc.version "1.43.0" >= 0;
|
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "alacritty-ligatures";
|
2020-10-15 22:38:34 +11:00
|
|
|
version = "0.5.0.20201015";
|
2020-10-15 19:05:13 +11:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "zenixls2";
|
|
|
|
repo = "alacritty";
|
|
|
|
fetchSubmodules = true;
|
2020-10-15 22:38:34 +11:00
|
|
|
rev = "30ebb4303229acbfdbbf00a84a9c46973c4e0334";
|
|
|
|
sha256 = "1c0951zs1h2d6fjnxixfms3913m1c6yvgmcizgd9gfgx59ghpafi";
|
2020-10-15 19:05:13 +11:00
|
|
|
};
|
|
|
|
|
2020-10-15 22:38:34 +11:00
|
|
|
cargoSha256 = "1zvj8hdlc3fii1ffwkigvxjigwx53vls543pgcv3a2bw4sn1ky1k";
|
2020-10-15 19:05:13 +11:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
gzip
|
|
|
|
installShellFiles
|
|
|
|
makeWrapper
|
|
|
|
ncurses
|
|
|
|
pkgconfig
|
|
|
|
python3
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = rpathLibs
|
|
|
|
++ lib.optionals stdenv.isDarwin [
|
|
|
|
AppKit
|
|
|
|
CoreGraphics
|
|
|
|
CoreServices
|
|
|
|
CoreText
|
|
|
|
Foundation
|
|
|
|
OpenGL
|
|
|
|
];
|
|
|
|
|
|
|
|
outputs = [ "out" "terminfo" ];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace alacritty/src/config/mouse.rs \
|
|
|
|
--replace xdg-open ${xdg_utils}/bin/xdg-open
|
|
|
|
'';
|
|
|
|
|
|
|
|
postBuild = lib.optionalString stdenv.isDarwin "make app";
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
install -D target/${triple}/release/alacritty $out/bin/alacritty
|
|
|
|
|
|
|
|
'' + (
|
|
|
|
if stdenv.isDarwin then ''
|
|
|
|
mkdir $out/Applications
|
|
|
|
cp -r target/${triple}/release/osx/Alacritty.app $out/Applications/Alacritty.app
|
|
|
|
'' else ''
|
|
|
|
install -D extra/linux/Alacritty.desktop -t $out/share/applications/
|
|
|
|
install -D extra/logo/alacritty-term.svg $out/share/icons/hicolor/scalable/apps/Alacritty.svg
|
|
|
|
patchelf --set-rpath "${lib.makeLibraryPath rpathLibs}" $out/bin/alacritty
|
|
|
|
''
|
|
|
|
) + ''
|
|
|
|
|
|
|
|
installShellCompletion --zsh extra/completions/_alacritty
|
|
|
|
installShellCompletion --bash extra/completions/alacritty.bash
|
|
|
|
installShellCompletion --fish extra/completions/alacritty.fish
|
|
|
|
|
|
|
|
install -dm 755 "$out/share/man/man1"
|
|
|
|
gzip -c extra/alacritty.man > "$out/share/man/man1/alacritty.1.gz"
|
|
|
|
|
|
|
|
install -dm 755 "$terminfo/share/terminfo/a/"
|
|
|
|
tic -xe alacritty,alacritty-direct -o "$terminfo/share/terminfo" extra/alacritty.info
|
|
|
|
mkdir -p $out/nix-support
|
|
|
|
echo "$terminfo" >> $out/nix-support/propagated-user-env-packages
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
dontPatchELF = true;
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "A cross-platform, GPU-accelerated terminal emulator";
|
|
|
|
homepage = "https://github.com/alacritty/alacritty";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ filalex77 mic92 cole-h ma27 ];
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|