nixpkgs/pkgs/by-name/al/alacritty/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

129 lines
3.5 KiB
Nix
Raw Normal View History

{ stdenv
, lib
, fetchFromGitHub
, rustPlatform
, nixosTests
, cmake
, installShellFiles
, makeWrapper
, ncurses
, pkg-config
, python3
2023-12-28 11:45:13 +00:00
, scdoc
, expat
, fontconfig
, freetype
, libGL
, xorg
, libxkbcommon
, wayland
2021-02-01 08:05:09 +00:00
, xdg-utils
2019-06-10 02:42:21 +00:00
, apple-sdk_11
}:
let
rpathLibs = [
expat
fontconfig
2019-06-10 02:42:21 +00:00
freetype
2023-06-05 08:09:19 +00:00
] ++ lib.optionals stdenv.hostPlatform.isLinux [
2019-06-10 02:42:21 +00:00
libGL
xorg.libX11
xorg.libXcursor
xorg.libXi
xorg.libXxf86vm
xorg.libxcb
libxkbcommon
2019-06-10 02:42:21 +00:00
wayland
];
in
rustPlatform.buildRustPackage rec {
2019-04-08 22:30:18 +00:00
pname = "alacritty";
2024-10-23 01:29:32 +00:00
version = "0.14.0";
2018-10-11 09:45:42 +00:00
src = fetchFromGitHub {
owner = "alacritty";
2019-04-08 22:30:18 +00:00
repo = pname;
2022-03-01 02:01:37 +00:00
rev = "refs/tags/v${version}";
2024-10-23 01:29:32 +00:00
hash = "sha256-ZhkuuxTx2y8vOfxfpDpJAyNyDdRWab0pqyDdbOCQ2XE=";
};
2024-10-23 01:29:32 +00:00
cargoHash = "sha256-T+/G2z7H/egJ/IlP3KA31jydg1CmFdLW8bLYSf/yWck=";
2017-11-13 16:26:44 +00:00
nativeBuildInputs = [
cmake
2020-01-09 16:18:13 +00:00
installShellFiles
makeWrapper
ncurses
pkg-config
2019-06-10 02:42:21 +00:00
python3
2023-12-28 11:45:13 +00:00
scdoc
2017-11-13 16:26:44 +00:00
];
2018-05-19 06:53:23 +00:00
buildInputs = rpathLibs
++ lib.optionals stdenv.hostPlatform.isDarwin [
apple-sdk_11
];
2018-11-03 15:39:14 +00:00
outputs = [ "out" "terminfo" ];
postPatch = lib.optionalString stdenv.hostPlatform.isLinux ''
2021-05-19 18:55:47 +00:00
substituteInPlace alacritty/src/config/ui_config.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
checkFlags = [ "--skip=term::test::mock_term" ]; # broken on aarch64
postInstall = (
if stdenv.hostPlatform.isDarwin then ''
mkdir $out/Applications
2020-06-20 09:20:00 +00:00
cp -r extra/osx/Alacritty.app $out/Applications
ln -s $out/bin $out/Applications/Alacritty.app/Contents/MacOS
'' else ''
install -D extra/linux/Alacritty.desktop -t $out/share/applications/
install -D extra/linux/org.alacritty.Alacritty.appdata.xml -t $out/share/appdata/
2020-05-06 19:13:41 +00:00
install -D extra/logo/compat/alacritty-term.svg $out/share/icons/hicolor/scalable/apps/Alacritty.svg
# 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
patchelf --add-rpath "${lib.makeLibraryPath rpathLibs}" $out/bin/alacritty
''
) + ''
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 15:19:23 +00:00
install -dm 755 "$out/share/man/man1"
2023-12-28 11:45:13 +00:00
install -dm 755 "$out/share/man/man5"
2023-12-28 11:45:13 +00:00
scdoc < extra/man/alacritty.1.scd | gzip -c > $out/share/man/man1/alacritty.1.gz
scdoc < extra/man/alacritty-msg.1.scd | gzip -c > $out/share/man/man1/alacritty-msg.1.gz
scdoc < extra/man/alacritty.5.scd | gzip -c > $out/share/man/man5/alacritty.5.gz
scdoc < extra/man/alacritty-bindings.5.scd | gzip -c > $out/share/man/man5/alacritty-bindings.5.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
'';
dontPatchELF = true;
passthru.tests.test = nixosTests.terminal-emulators.alacritty;
meta = with lib; {
description = "Cross-platform, GPU-accelerated terminal emulator";
homepage = "https://github.com/alacritty/alacritty";
2020-01-09 16:18:13 +00:00
license = licenses.asl20;
mainProgram = "alacritty";
maintainers = with maintainers; [ Br1ght0ne mic92 ];
2020-01-09 16:18:13 +00:00
platforms = platforms.unix;
2021-02-10 22:19:11 +00:00
changelog = "https://github.com/alacritty/alacritty/blob/v${version}/CHANGELOG.md";
};
}