From e6e229dc20b3492c2f2b7789f61b6fb8adf43ee3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Tue, 24 Sep 2024 13:08:52 +0200 Subject: [PATCH] wezterm: add headless package for mux server --- .../terminal-emulators/wezterm/default.nix | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/terminal-emulators/wezterm/default.nix b/pkgs/applications/terminal-emulators/wezterm/default.nix index 2fb094420407..c13c9819476e 100644 --- a/pkgs/applications/terminal-emulators/wezterm/default.nix +++ b/pkgs/applications/terminal-emulators/wezterm/default.nix @@ -36,7 +36,7 @@ rustPlatform.buildRustPackage rec { src = fetchFromGitHub { owner = "wez"; - repo = pname; + repo = "wezterm"; rev = version; fetchSubmodules = true; hash = "sha256-Az+HlnK/lRJpUSGm5UKyma1l2PaBKNCGFiaYnLECMX8="; @@ -49,6 +49,13 @@ rustPlatform.buildRustPackage rec { # tests are failing with: Unable to exchange encryption keys rm -r wezterm-ssh/tests + + # hash does not work well with NixOS + substituteInPlace assets/shell-integration/wezterm.sh \ + --replace-fail 'hash wezterm 2>/dev/null' 'command type -P wezterm &>/dev/null' \ + --replace-fail 'hash base64 2>/dev/null' 'command type -P base64 &>/dev/null' \ + --replace-fail 'hash hostname 2>/dev/null' 'command type -P hostname &>/dev/null' \ + --replace-fail 'hash hostnamectl 2>/dev/null' 'command type -P hostnamectl &>/dev/null' ''; cargoLock = { @@ -123,6 +130,28 @@ rustPlatform.buildRustPackage rec { ''; passthru = { + # the headless variant is useful when deploying wezterm's mux server on remote severs + headless = rustPlatform.buildRustPackage { + pname = "${pname}-headless"; + inherit version src postPatch cargoLock meta; + + nativeBuildInputs = [ pkg-config ]; + + buildInputs = [ openssl ]; + + cargoBuildFlags = [ + "--package" "wezterm" + "--package" "wezterm-mux-server" + ]; + + doCheck = false; + + postInstall = '' + install -Dm644 assets/shell-integration/wezterm.sh -t $out/etc/profile.d + install -Dm644 ${passthru.terminfo}/share/terminfo/w/wezterm -t $out/share/terminfo/w + ''; + }; + terminfo = runCommand "wezterm-terminfo" { nativeBuildInputs = [ ncurses ]; } ''