From 2a3d78493886e193e2015a3c918e46f483f335d6 Mon Sep 17 00:00:00 2001 From: m3ta-chiron Date: Mon, 11 May 2026 18:23:26 +0200 Subject: [PATCH] feat: add hermes-remote CLI shortcut (SSH + Zellij to m3-hermes) --- profiles/base/cli-tools/default.nix | 1 + profiles/base/cli-tools/hermes-remote.nix | 37 +++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 profiles/base/cli-tools/hermes-remote.nix diff --git a/profiles/base/cli-tools/default.nix b/profiles/base/cli-tools/default.nix index 3125597..959abea 100644 --- a/profiles/base/cli-tools/default.nix +++ b/profiles/base/cli-tools/default.nix @@ -6,6 +6,7 @@ ./direnv.nix ./eza.nix ./fzf.nix + ./hermes-remote.nix ./lf.nix ./nitch.nix ./packages.nix diff --git a/profiles/base/cli-tools/hermes-remote.nix b/profiles/base/cli-tools/hermes-remote.nix new file mode 100644 index 0000000..01bb3a4 --- /dev/null +++ b/profiles/base/cli-tools/hermes-remote.nix @@ -0,0 +1,37 @@ +# 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}" + '') + ]; + }; +}