2021-01-09 10:05:03 +00:00
|
|
|
{ stdenv
|
|
|
|
, rustPlatform
|
2020-12-25 13:55:36 +00:00
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
2021-06-06 07:54:09 +00:00
|
|
|
, ncurses
|
2021-12-06 16:07:01 +00:00
|
|
|
, perl
|
2020-12-25 13:55:36 +00:00
|
|
|
, pkg-config
|
|
|
|
, python3
|
2021-08-25 08:27:29 +00:00
|
|
|
, fontconfig
|
2020-12-25 13:55:36 +00:00
|
|
|
, openssl
|
2021-08-25 08:27:29 +00:00
|
|
|
, libGL
|
2020-12-25 13:55:36 +00:00
|
|
|
, libX11
|
|
|
|
, libxcb
|
2021-08-25 08:27:29 +00:00
|
|
|
, libxkbcommon
|
|
|
|
, xcbutil
|
2021-04-13 19:44:15 +00:00
|
|
|
, xcbutilimage
|
2020-12-25 13:55:36 +00:00
|
|
|
, xcbutilkeysyms
|
2021-08-25 08:27:29 +00:00
|
|
|
, xcbutilwm
|
2020-12-25 13:55:36 +00:00
|
|
|
, wayland
|
|
|
|
, zlib
|
2021-04-13 19:44:15 +00:00
|
|
|
, CoreGraphics
|
|
|
|
, Cocoa
|
|
|
|
, Foundation
|
|
|
|
, libiconv
|
2022-03-30 09:31:56 +00:00
|
|
|
, nixosTests
|
2020-12-25 13:55:36 +00:00
|
|
|
}:
|
|
|
|
|
2021-04-13 19:44:15 +00:00
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "wezterm";
|
2022-04-15 01:41:22 +00:00
|
|
|
version = "20220408-101518-b908e2dd";
|
2020-12-25 13:55:36 +00:00
|
|
|
|
2021-08-25 08:27:29 +00:00
|
|
|
outputs = [ "out" "terminfo" ];
|
|
|
|
|
2020-12-25 13:55:36 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "wez";
|
|
|
|
repo = pname;
|
2021-05-20 23:08:51 +00:00
|
|
|
rev = version;
|
2020-12-25 13:55:36 +00:00
|
|
|
fetchSubmodules = true;
|
2022-04-15 01:41:22 +00:00
|
|
|
sha256 = "sha256-kuuoD+hqgj7QXFRIxa112oc4idtcK0ptFACDpI0bzGY=";
|
2020-12-25 13:55:36 +00:00
|
|
|
};
|
2021-04-13 19:44:15 +00:00
|
|
|
|
2021-04-15 00:37:46 +00:00
|
|
|
postPatch = ''
|
|
|
|
echo ${version} > .tag
|
2021-12-06 16:07:01 +00:00
|
|
|
|
|
|
|
# tests are failing with: Unable to exchange encryption keys
|
|
|
|
rm -r wezterm-ssh/tests
|
2021-04-15 00:37:46 +00:00
|
|
|
'';
|
|
|
|
|
2022-04-15 01:41:22 +00:00
|
|
|
cargoSha256 = "sha256-iIb2zLUZpn23ooEiOP+yQMYUUmvef/KqvjzgLOFmjs0=";
|
2020-12-25 13:55:36 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
pkg-config
|
|
|
|
python3
|
2021-08-25 08:27:29 +00:00
|
|
|
ncurses # tic for terminfo
|
2021-12-06 16:07:01 +00:00
|
|
|
] ++ lib.optional stdenv.isDarwin perl;
|
2020-12-25 13:55:36 +00:00
|
|
|
|
2021-08-25 08:27:29 +00:00
|
|
|
buildInputs = [
|
|
|
|
fontconfig
|
|
|
|
zlib
|
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
|
|
libX11
|
|
|
|
libxcb
|
|
|
|
libxkbcommon
|
|
|
|
openssl
|
|
|
|
wayland
|
|
|
|
xcbutil
|
|
|
|
xcbutilimage
|
|
|
|
xcbutilkeysyms
|
|
|
|
xcbutilwm # contains xcb-ewmh among others
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
Cocoa
|
|
|
|
CoreGraphics
|
|
|
|
Foundation
|
|
|
|
libiconv
|
|
|
|
];
|
2020-12-25 13:55:36 +00:00
|
|
|
|
2021-06-06 07:54:09 +00:00
|
|
|
postInstall = ''
|
2021-08-18 13:19:15 +00:00
|
|
|
# terminfo
|
2021-06-06 07:54:09 +00:00
|
|
|
mkdir -p $terminfo/share/terminfo/w $out/nix-support
|
|
|
|
tic -x -o $terminfo/share/terminfo termwiz/data/wezterm.terminfo
|
|
|
|
echo "$terminfo" >> $out/nix-support/propagated-user-env-packages
|
2021-08-05 21:33:18 +00:00
|
|
|
|
2021-08-18 13:19:15 +00:00
|
|
|
# desktop icon
|
2021-08-05 21:33:18 +00:00
|
|
|
install -Dm644 assets/icon/terminal.png $out/share/icons/hicolor/128x128/apps/org.wezfurlong.wezterm.png
|
|
|
|
install -Dm644 assets/wezterm.desktop $out/share/applications/org.wezfurlong.wezterm.desktop
|
|
|
|
install -Dm644 assets/wezterm.appdata.xml $out/share/metainfo/org.wezfurlong.wezterm.appdata.xml
|
2021-08-18 13:19:15 +00:00
|
|
|
|
|
|
|
# helper scripts
|
2021-08-27 14:25:00 +00:00
|
|
|
install -Dm644 assets/shell-integration/wezterm.sh -t $out/etc/profile.d
|
2021-06-06 07:54:09 +00:00
|
|
|
'';
|
|
|
|
|
2021-04-13 19:44:15 +00:00
|
|
|
preFixup = lib.optionalString stdenv.isLinux ''
|
2021-08-25 08:27:29 +00:00
|
|
|
patchelf --add-needed "${libGL}/lib/libEGL.so.1" $out/bin/wezterm-gui
|
2021-01-17 00:15:33 +00:00
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
2021-04-13 19:44:15 +00:00
|
|
|
mkdir -p "$out/Applications"
|
|
|
|
OUT_APP="$out/Applications/WezTerm.app"
|
|
|
|
cp -r assets/macos/WezTerm.app "$OUT_APP"
|
|
|
|
rm $OUT_APP/*.dylib
|
|
|
|
cp -r assets/shell-integration/* "$OUT_APP"
|
|
|
|
ln -s $out/bin/{wezterm,wezterm-mux-server,wezterm-gui,strip-ansi-escapes} "$OUT_APP"
|
2020-12-25 13:55:36 +00:00
|
|
|
'';
|
|
|
|
|
2022-04-15 01:41:22 +00:00
|
|
|
passthru.tests = {
|
|
|
|
all-terminfo = nixosTests.allTerminfo;
|
|
|
|
test = nixosTests.terminal-emulators.wezterm;
|
|
|
|
};
|
2022-03-30 09:31:56 +00:00
|
|
|
|
2020-12-25 13:55:36 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust";
|
|
|
|
homepage = "https://wezfurlong.org/wezterm";
|
|
|
|
license = licenses.mit;
|
2021-08-25 08:27:29 +00:00
|
|
|
maintainers = with maintainers; [ SuperSandro2000 ];
|
2020-12-25 13:55:36 +00:00
|
|
|
platforms = platforms.unix;
|
2021-12-06 16:07:01 +00:00
|
|
|
# Fails on missing UserNotifications framework while linking
|
|
|
|
broken = stdenv.isDarwin;
|
2020-12-25 13:55:36 +00:00
|
|
|
};
|
|
|
|
}
|