alacritty-ligatures: override upstream directly

The old method was having the alacritty build copy-pasted into the repo
and making minor changes. This worked but isn't really feasible as it
doesn't incoroprate upstream (build) changes without noticing.

This commit finally works out how to override buildRustPackage to set
the Cargo dependency.
This commit is contained in:
xeals 2020-10-15 22:38:34 +11:00
parent 274ef8a92a
commit 6bd6a13e51
Signed by: xeals
GPG Key ID: A498C7AF27EC6B5C
2 changed files with 21 additions and 149 deletions

View File

@ -15,12 +15,29 @@ rec {
overlays = import ./overlays; # nixpkgs overlays
# Alacritty with the unmerged ligature patches applied.
alacritty-ligatures = pkgs.callPackage ./pkgs/applications/misc/alacritty/ligatures.nix {
alacritty-ligatures = (pkgs.alacritty.override {
# Requires a minimum of 1.41, and this is the only version on both stable
# and unstable channels right now.
inherit (pkgs.rustPackages_1_44) rustPlatform;
inherit (pkgs.xorg) libXcursor libXxf86vm libXi;
inherit (pkgs.darwin.appls_sdk.frameworks) AppKit CoreGraphics CoreServices CoreText Foundation OpenGL;
}).overrideAttrs (oldAttrs: rec {
pname = "${oldAttrs.pname}-ligatures";
version = "0.6.0.20201015";
src = pkgs.fetchFromGitHub {
owner = "zenixls2";
repo = "alacritty";
fetchSubmodules = true;
rev = "30ebb4303229acbfdbbf00a84a9c46973c4e0334";
sha256 = "1c0951zs1h2d6fjnxixfms3913m1c6yvgmcizgd9gfgx59ghpafi";
};
cargoDeps = oldAttrs.cargoDeps.overrideAttrs (pkgs.lib.const {
name = "${pname}-${version}-vendor";
inherit src;
outputHash = "1zvj8hdlc3fii1ffwkigvxjigwx53vls543pgcv3a2bw4sn1ky1k";
});
});
amdgpu-fan = pkgs.callPackage ./pkgs/tools/misc/amdgpu-fan { };
go-qt = pkgs.libsForQt512.callPackage ./pkgs/development/go-modules/qt { };

View File

@ -1,145 +0,0 @@
{ 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";
version = "0.5.0.20200908";
src = fetchFromGitHub {
owner = "zenixls2";
repo = "alacritty";
fetchSubmodules = true;
rev = "693de26a9fe9bc1252a721a6ba50ef4b34500d33";
sha256 = "0ybmn6fjn59nnk94bwr19d3rasf5x4c7wp2fynw9s69mm4ryz0n4";
};
cargoSha256 = "10ma465wy2n39l5pl3a9mz0lfxwgqbgla6s7dskzj1i1vnq2n2dy";
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;
};
}