summaryrefslogtreecommitdiffstats
path: root/configs/hermes.nix
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-20 04:36:37 +0000
committertv <tv@krebsco.de>2026-11-20 05:59:31 +0100
commit41e5a1003875c1e43c55b903fa218347e511789c (patch)
tree2b427df495800869f3d84ee6ffafe10b8a77a34c /configs/hermes.nix
parent6b11fb3621849862d8573d36ca204a2fcb323e31 (diff)
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.
Diffstat (limited to 'configs/hermes.nix')
-rw-r--r--configs/hermes.nix9
1 files 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.