2023-04-07 19:24:13 +03:00
|
|
|
{
|
|
|
|
description = "A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust";
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
2023-12-04 02:30:33 +03:00
|
|
|
rust-overlay = {
|
|
|
|
url = "github:oxalica/rust-overlay";
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.follows = "nixpkgs";
|
|
|
|
flake-utils.follows = "flake-utils";
|
|
|
|
};
|
|
|
|
};
|
2023-04-07 19:24:13 +03:00
|
|
|
|
|
|
|
freetype2 = {
|
|
|
|
url = "github:wez/freetype2/de8b92dd7ec634e9e2b25ef534c54a3537555c11";
|
|
|
|
flake = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
harfbuzz = {
|
|
|
|
url = "github:harfbuzz/harfbuzz/60841e26187576bff477c1a09ee2ffe544844abc";
|
|
|
|
flake = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
libpng = {
|
|
|
|
url = "github:glennrp/libpng/8439534daa1d3a5705ba92e653eda9251246dd61";
|
|
|
|
flake = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
zlib = {
|
|
|
|
url = "github:madler/zlib/cacf7f1d4e3d44d871b605da3b647f07d718623f";
|
|
|
|
flake = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-01-17 18:58:34 +03:00
|
|
|
outputs = inputs @ {self, ...}:
|
|
|
|
inputs.flake-utils.lib.eachDefaultSystem (system: let
|
|
|
|
overlays = [(import inputs.rust-overlay)];
|
|
|
|
pkgs = import (inputs.nixpkgs) {inherit system overlays;};
|
|
|
|
|
|
|
|
inherit (inputs.nixpkgs) lib;
|
2023-04-07 19:24:13 +03:00
|
|
|
inherit (pkgs) stdenv;
|
|
|
|
|
|
|
|
nativeBuildInputs = with pkgs;
|
|
|
|
[
|
|
|
|
installShellFiles
|
|
|
|
ncurses # tic for terminfo
|
|
|
|
pkg-config
|
|
|
|
python3
|
|
|
|
]
|
|
|
|
++ lib.optional stdenv.isDarwin perl;
|
|
|
|
|
|
|
|
buildInputs = with pkgs;
|
|
|
|
[
|
|
|
|
fontconfig
|
|
|
|
pkgs.zlib
|
|
|
|
]
|
|
|
|
++ lib.optionals stdenv.isLinux [
|
|
|
|
libxkbcommon
|
|
|
|
openssl
|
|
|
|
wayland
|
2024-01-17 18:58:34 +03:00
|
|
|
|
|
|
|
xorg.libX11
|
|
|
|
xorg.libxcb
|
2023-04-07 19:24:13 +03:00
|
|
|
xorg.xcbutil
|
|
|
|
xorg.xcbutilimage
|
|
|
|
xorg.xcbutilkeysyms
|
|
|
|
xorg.xcbutilwm # contains xcb-ewmh among others
|
|
|
|
]
|
2024-01-17 18:22:27 +03:00
|
|
|
++ lib.optionals stdenv.isDarwin (
|
|
|
|
(with pkgs.darwin.apple_sdk.frameworks; [
|
|
|
|
Cocoa
|
|
|
|
CoreGraphics
|
|
|
|
Foundation
|
|
|
|
UserNotifications
|
|
|
|
])
|
|
|
|
++ [pkgs.libiconv]
|
|
|
|
);
|
2023-04-07 19:24:13 +03:00
|
|
|
|
2024-01-17 18:58:34 +03:00
|
|
|
libPath = lib.makeLibraryPath (with pkgs; [
|
|
|
|
xorg.xcbutilimage
|
|
|
|
libGL
|
|
|
|
vulkan-loader
|
|
|
|
]);
|
2023-12-04 02:30:33 +03:00
|
|
|
|
|
|
|
rustPlatform = pkgs.makeRustPlatform {
|
|
|
|
cargo = pkgs.rust-bin.stable.latest.minimal;
|
|
|
|
rustc = pkgs.rust-bin.stable.latest.minimal;
|
|
|
|
};
|
2023-04-07 19:24:13 +03:00
|
|
|
in {
|
2023-12-04 02:30:33 +03:00
|
|
|
packages.default = rustPlatform.buildRustPackage rec {
|
2023-04-07 19:24:13 +03:00
|
|
|
inherit buildInputs nativeBuildInputs;
|
|
|
|
|
|
|
|
name = "wezterm";
|
2023-12-04 02:16:17 +03:00
|
|
|
src = ./..;
|
2023-04-07 19:24:13 +03:00
|
|
|
version = self.shortRev or "dev";
|
|
|
|
|
|
|
|
cargoLock = {
|
2023-12-04 02:16:17 +03:00
|
|
|
lockFile = ../Cargo.lock;
|
2023-04-07 19:24:13 +03:00
|
|
|
outputHashes = {
|
|
|
|
"xcb-imdkit-0.2.0" = "sha256-L+NKD0rsCk9bFABQF4FZi9YoqBHr4VAZeKAWgsaAegw=";
|
|
|
|
"xcb-1.2.1" = "sha256-zkuW5ATix3WXBAj2hzum1MJ5JTX3+uVQ01R1vL6F1rY=";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
rm -rf deps/freetype/freetype2 deps/freetype/libpng \
|
|
|
|
deps/freetype/zlib deps/harfbuzz/harfbuzz
|
|
|
|
|
2024-01-17 18:58:34 +03:00
|
|
|
ln -s ${inputs.freetype2} deps/freetype/freetype2
|
|
|
|
ln -s ${inputs.libpng} deps/freetype/libpng
|
|
|
|
ln -s ${inputs.zlib} deps/freetype/zlib
|
|
|
|
ln -s ${inputs.harfbuzz} deps/harfbuzz/harfbuzz
|
2023-04-07 19:24:13 +03:00
|
|
|
'';
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
echo ${version} > .tag
|
|
|
|
|
|
|
|
# tests are failing with: Unable to exchange encryption keys
|
|
|
|
rm -r wezterm-ssh/tests
|
|
|
|
'';
|
|
|
|
|
|
|
|
preFixup = lib.optionalString stdenv.isLinux ''
|
|
|
|
patchelf \
|
|
|
|
--add-needed "${pkgs.libGL}/lib/libEGL.so.1" \
|
|
|
|
--add-needed "${pkgs.vulkan-loader}/lib/libvulkan.so.1" \
|
|
|
|
$out/bin/wezterm-gui
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
devShell = pkgs.mkShell {
|
|
|
|
name = "wezterm-shell";
|
2024-01-17 18:58:34 +03:00
|
|
|
inherit nativeBuildInputs;
|
|
|
|
|
|
|
|
buildInputs =
|
|
|
|
buildInputs
|
|
|
|
++ (with pkgs.rust-bin; [
|
|
|
|
stable.latest.minimal
|
|
|
|
stable.latest.clippy
|
|
|
|
|
|
|
|
nightly.latest.rustfmt
|
|
|
|
nightly.latest.rust-analyzer
|
|
|
|
]);
|
2023-04-07 19:24:13 +03:00
|
|
|
|
|
|
|
LD_LIBRARY_PATH = libPath;
|
2024-01-17 18:58:34 +03:00
|
|
|
RUST_BACKTRACE = 1;
|
2023-04-07 19:24:13 +03:00
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|