From 41e5a1003875c1e43c55b903fa218347e511789c Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 20 Nov 2026 04:36:37 +0000 Subject: configs/hermes: add hermes-attach, root's way back into hermes' tmux Root's login shell attaches to hermes' tmux, and detaching gives the shell back, but getting into the tmux again took tmux with the right socket. hermes-attach does that, and the login shell uses it, too. --- configs/hermes.nix | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/configs/hermes.nix b/configs/hermes.nix index 5ff49d9..c1a6cb6 100644 --- a/configs/hermes.nix +++ b/configs/hermes.nix @@ -5,6 +5,10 @@ { config, lib, pkgs, ... }: let tmux = "${pkgs.tmux}/bin/tmux -S /run/hermes/tmux"; + # Root's way (back) into hermes' tmux. + hermes-attach = pkgs.writeShellScriptBin "hermes-attach" '' + exec ${tmux} attach -t hermes + ''; # Bump url and sha256 together. src = builtins.fetchTarball { @@ -108,9 +112,10 @@ in }; inherit (config.systemd.services.hermes-agent) path; }; - # Detaching gets root's shell back. + # Detaching gets root's shell back, and hermes-attach goes back in. + environment.systemPackages = [ hermes-attach ]; programs.bash.loginShellInit = '' - if [ "$USER" = root ] && [ -z "$TMUX" ]; then ${tmux} attach -t hermes; fi + if [ "$USER" = root ] && [ -z "$TMUX" ]; then ${lib.getExe hermes-attach}; fi ''; # The module adds pkgs.git, which needs perl; the package has gitMinimal. -- cgit v1.3.1