124 lines
2.8 KiB
Nix
124 lines
2.8 KiB
Nix
{ stdenv,
|
|
lib,
|
|
fetchFromGitHub,
|
|
rustPlatform,
|
|
cmake,
|
|
makeWrapper,
|
|
ncurses,
|
|
expat,
|
|
pkgconfig,
|
|
freetype,
|
|
fontconfig,
|
|
libX11,
|
|
gzip,
|
|
libXcursor,
|
|
libXxf86vm,
|
|
libXi,
|
|
libXrandr,
|
|
libGL,
|
|
xclip,
|
|
wayland,
|
|
libxkbcommon,
|
|
# Darwin Frameworks
|
|
cf-private,
|
|
AppKit,
|
|
CoreFoundation,
|
|
CoreGraphics,
|
|
CoreServices,
|
|
CoreText,
|
|
Foundation,
|
|
OpenGL }:
|
|
|
|
with rustPlatform;
|
|
|
|
let
|
|
rpathLibs = [
|
|
expat
|
|
freetype
|
|
fontconfig
|
|
libX11
|
|
libXcursor
|
|
libXxf86vm
|
|
libXrandr
|
|
libGL
|
|
libXi
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
wayland
|
|
libxkbcommon
|
|
];
|
|
in buildRustPackage rec {
|
|
pname = "alacritty";
|
|
version = "0.3.1";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "jwilm";
|
|
repo = pname;
|
|
rev = "v${version}";
|
|
sha256 = "1z6xijgkahvcl4cq0yn3y6sc6r4ydnrl5c0qzzsr2vndwzig07yz";
|
|
};
|
|
|
|
cargoSha256 = "02q5kkr0zygpm9i2hd1sr246f18pyia1lq9dwjagqk7d2x3xlc7p";
|
|
|
|
nativeBuildInputs = [
|
|
cmake
|
|
makeWrapper
|
|
pkgconfig
|
|
ncurses
|
|
gzip
|
|
];
|
|
|
|
buildInputs = rpathLibs
|
|
++ lib.optionals stdenv.isDarwin [
|
|
AppKit CoreFoundation CoreGraphics CoreServices CoreText Foundation OpenGL
|
|
# Needed for CFURLResourceIsReachable symbols.
|
|
cf-private
|
|
];
|
|
|
|
outputs = [ "out" "terminfo" ];
|
|
|
|
postPatch = ''
|
|
substituteInPlace copypasta/src/x11.rs \
|
|
--replace Command::new\(\"xclip\"\) Command::new\(\"${xclip}/bin/xclip\"\)
|
|
'';
|
|
|
|
postBuild = lib.optionalString stdenv.isDarwin "make app";
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
install -D target/release/alacritty $out/bin/alacritty
|
|
|
|
'' + (if stdenv.isDarwin then ''
|
|
mkdir $out/Applications
|
|
cp -r target/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 "${stdenv.lib.makeLibraryPath rpathLibs}" $out/bin/alacritty
|
|
'') + ''
|
|
|
|
install -D extra/completions/_alacritty -t "$out/share/zsh/site-functions/"
|
|
install -D extra/completions/alacritty.bash -t "$out/etc/bash_completion.d/"
|
|
install -D extra/completions/alacritty.fish -t "$out/share/fish/vendor_completions.d/"
|
|
|
|
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 -x -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 stdenv.lib; {
|
|
description = "GPU-accelerated terminal emulator";
|
|
homepage = https://github.com/jwilm/alacritty;
|
|
license = with licenses; [ asl20 ];
|
|
maintainers = with maintainers; [ mic92 ];
|
|
platforms = [ "x86_64-linux" "x86_64-darwin" ];
|
|
};
|
|
}
|