2020-03-19 03:48:31 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, rustPlatform
|
|
|
|
|
|
|
|
, cmake
|
|
|
|
, gzip
|
|
|
|
, installShellFiles
|
|
|
|
, makeWrapper
|
|
|
|
, ncurses
|
2021-01-19 06:50:56 +00:00
|
|
|
, pkg-config
|
2020-03-19 03:48:31 +00:00
|
|
|
, python3
|
|
|
|
|
|
|
|
, expat
|
|
|
|
, fontconfig
|
|
|
|
, freetype
|
|
|
|
, libGL
|
|
|
|
, libX11
|
|
|
|
, libXcursor
|
|
|
|
, libXi
|
|
|
|
, libXrandr
|
|
|
|
, libXxf86vm
|
|
|
|
, libxcb
|
|
|
|
, libxkbcommon
|
|
|
|
, wayland
|
2021-02-01 08:05:09 +00:00
|
|
|
, xdg-utils
|
2019-06-10 03:42:21 +01:00
|
|
|
|
2018-05-19 07:53:23 +01:00
|
|
|
# Darwin Frameworks
|
2020-03-19 03:48:31 +00:00
|
|
|
, AppKit
|
|
|
|
, CoreGraphics
|
|
|
|
, CoreServices
|
|
|
|
, CoreText
|
|
|
|
, Foundation
|
|
|
|
, OpenGL
|
|
|
|
}:
|
2017-07-29 12:41:04 +01:00
|
|
|
let
|
|
|
|
rpathLibs = [
|
|
|
|
expat
|
|
|
|
fontconfig
|
2019-06-10 03:42:21 +01:00
|
|
|
freetype
|
|
|
|
libGL
|
2017-07-29 12:41:04 +01:00
|
|
|
libX11
|
|
|
|
libXcursor
|
|
|
|
libXi
|
2019-06-10 03:42:21 +01:00
|
|
|
libXrandr
|
|
|
|
libXxf86vm
|
|
|
|
libxcb
|
2019-02-21 07:12:30 +00:00
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
|
|
libxkbcommon
|
2019-06-10 03:42:21 +01:00
|
|
|
wayland
|
2017-07-29 12:41:04 +01:00
|
|
|
];
|
2020-03-19 03:48:31 +00:00
|
|
|
in
|
|
|
|
rustPlatform.buildRustPackage rec {
|
2019-04-08 23:30:18 +01:00
|
|
|
pname = "alacritty";
|
2021-02-20 00:29:33 +00:00
|
|
|
version = "0.7.2";
|
2017-04-01 16:06:19 +01:00
|
|
|
|
2018-10-11 10:45:42 +01:00
|
|
|
src = fetchFromGitHub {
|
2020-03-19 03:48:31 +00:00
|
|
|
owner = "alacritty";
|
2019-04-08 23:30:18 +01:00
|
|
|
repo = pname;
|
2018-10-11 10:45:42 +01:00
|
|
|
rev = "v${version}";
|
2021-02-20 00:29:33 +00:00
|
|
|
sha256 = "sha256-VXV6w4OnhJBmvMKl7CynbhI9LclTKaSr+5DhHXMwSsc=";
|
2017-04-01 16:06:19 +01:00
|
|
|
};
|
|
|
|
|
2021-02-20 00:29:33 +00:00
|
|
|
cargoSha256 = "sha256-PWnNTMNZKxsfS1OAXe4G3zjfg5gK1SMTc0JJrW90iSM=";
|
2017-04-01 16:06:19 +01:00
|
|
|
|
2017-11-13 16:26:44 +00:00
|
|
|
nativeBuildInputs = [
|
2017-04-01 16:06:19 +01:00
|
|
|
cmake
|
2019-06-10 03:42:21 +01:00
|
|
|
gzip
|
2020-01-09 16:18:13 +00:00
|
|
|
installShellFiles
|
2017-04-01 16:06:19 +01:00
|
|
|
makeWrapper
|
2018-07-19 15:59:43 +01:00
|
|
|
ncurses
|
2021-01-19 06:50:56 +00:00
|
|
|
pkg-config
|
2019-06-10 03:42:21 +01:00
|
|
|
python3
|
2017-11-13 16:26:44 +00:00
|
|
|
];
|
|
|
|
|
2018-05-19 07:53:23 +01:00
|
|
|
buildInputs = rpathLibs
|
2020-11-25 01:16:54 +00:00
|
|
|
++ lib.optionals stdenv.isDarwin [
|
2020-03-19 03:48:31 +00:00
|
|
|
AppKit
|
|
|
|
CoreGraphics
|
|
|
|
CoreServices
|
|
|
|
CoreText
|
|
|
|
Foundation
|
|
|
|
OpenGL
|
|
|
|
];
|
2017-04-01 16:06:19 +01:00
|
|
|
|
2018-11-03 15:39:14 +00:00
|
|
|
outputs = [ "out" "terminfo" ];
|
2020-03-19 03:48:31 +00:00
|
|
|
|
2020-02-20 13:12:47 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace alacritty/src/config/mouse.rs \
|
2021-02-01 08:05:09 +00:00
|
|
|
--replace xdg-open ${xdg-utils}/bin/xdg-open
|
2020-02-20 13:12:47 +00:00
|
|
|
'';
|
2018-11-03 15:39:14 +00:00
|
|
|
|
2021-02-26 20:59:45 +00:00
|
|
|
postInstall = (
|
2020-03-19 03:48:31 +00:00
|
|
|
if stdenv.isDarwin then ''
|
|
|
|
mkdir $out/Applications
|
2020-06-20 10:20:00 +01:00
|
|
|
cp -r extra/osx/Alacritty.app $out/Applications
|
|
|
|
ln -s $out/bin $out/Applications/Alacritty.app/Contents/MacOS
|
2020-03-19 03:48:31 +00:00
|
|
|
'' else ''
|
|
|
|
install -D extra/linux/Alacritty.desktop -t $out/share/applications/
|
2020-05-06 20:13:41 +01:00
|
|
|
install -D extra/logo/compat/alacritty-term.svg $out/share/icons/hicolor/scalable/apps/Alacritty.svg
|
2020-04-20 04:48:04 +01:00
|
|
|
|
|
|
|
# patchelf generates an ELF that binutils' "strip" doesn't like:
|
|
|
|
# strip: not enough room for program headers, try linking with -N
|
|
|
|
# As a workaround, strip manually before running patchelf.
|
|
|
|
strip -S $out/bin/alacritty
|
|
|
|
|
2020-03-19 03:48:31 +00:00
|
|
|
patchelf --set-rpath "${lib.makeLibraryPath rpathLibs}" $out/bin/alacritty
|
|
|
|
''
|
|
|
|
) + ''
|
2018-05-19 07:53:23 +01:00
|
|
|
|
2020-01-09 16:18:13 +00:00
|
|
|
installShellCompletion --zsh extra/completions/_alacritty
|
|
|
|
installShellCompletion --bash extra/completions/alacritty.bash
|
|
|
|
installShellCompletion --fish extra/completions/alacritty.fish
|
2018-07-07 16:19:23 +01:00
|
|
|
|
2018-07-19 15:59:43 +01:00
|
|
|
install -dm 755 "$out/share/man/man1"
|
2019-04-08 23:30:18 +01:00
|
|
|
gzip -c extra/alacritty.man > "$out/share/man/man1/alacritty.1.gz"
|
2018-07-19 15:59:43 +01:00
|
|
|
|
2020-06-14 03:53:56 +01:00
|
|
|
install -Dm 644 alacritty.yml $out/share/doc/alacritty.yml
|
|
|
|
|
2018-07-19 15:59:43 +01:00
|
|
|
install -dm 755 "$terminfo/share/terminfo/a/"
|
2019-03-12 14:12:40 +00:00
|
|
|
tic -xe alacritty,alacritty-direct -o "$terminfo/share/terminfo" extra/alacritty.info
|
2018-07-19 15:59:43 +01:00
|
|
|
mkdir -p $out/nix-support
|
|
|
|
echo "$terminfo" >> $out/nix-support/propagated-user-env-packages
|
2017-04-01 16:06:19 +01:00
|
|
|
'';
|
|
|
|
|
2017-07-29 12:41:04 +01:00
|
|
|
dontPatchELF = true;
|
2017-04-01 16:06:19 +01:00
|
|
|
|
2020-03-19 03:48:31 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "A cross-platform, GPU-accelerated terminal emulator";
|
|
|
|
homepage = "https://github.com/alacritty/alacritty";
|
2020-01-09 16:18:13 +00:00
|
|
|
license = licenses.asl20;
|
2020-11-17 11:02:06 +00:00
|
|
|
maintainers = with maintainers; [ Br1ght0ne mic92 cole-h ma27 ];
|
2020-01-09 16:18:13 +00:00
|
|
|
platforms = platforms.unix;
|
2017-04-01 16:06:19 +01:00
|
|
|
};
|
|
|
|
}
|