Files
m3ta-home/profiles/base/cli-tools/hermes-remote.nix
T

38 lines
1.1 KiB
Nix

# hermes-remote — SSH into m3-hermes and attach/create a Zellij session running the Hermes CLI.
# Available on all hosts (base profile), uses the m3-hermes SSH match block.
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.base.cliTools.hermesRemote;
in {
options.base.cliTools.hermesRemote = {
enable = (mkEnableOption "enable hermes-remote shortcut") // {default = true;};
host = mkOption {
type = types.str;
default = "m3-hermes";
description = "SSH hostname (must match a matchBlocks entry).";
};
session = mkOption {
type = types.str;
default = "hermes";
description = "Zellij session name on the remote host.";
};
};
config = mkIf cfg.enable {
home.packages = [
(pkgs.writeShellScriptBin "hermes-remote" ''
# hermes-remote SSH into m3-hermes and attach/create a Zellij session with hermes CLI.
# Uses -t for PTY allocation (required by both Zellij and Hermes).
exec ssh -t ${cfg.host} "zellij attach -c ${cfg.session} || zellij -s ${cfg.session}"
'')
];
};
}