Merge branch 'master' of code.m3ta.dev:m3tam3re/m3ta-home
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
./direnv.nix
|
||||
./eza.nix
|
||||
./fzf.nix
|
||||
./hermes-remote.nix
|
||||
./lf.nix
|
||||
./nitch.nix
|
||||
./nix-index.nix
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
# 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 (resolved via ~/.ssh/config matchBlocks).";
|
||||
};
|
||||
|
||||
user = mkOption {
|
||||
type = types.str;
|
||||
default = "hermes";
|
||||
description = "Remote SSH user.";
|
||||
};
|
||||
|
||||
identityFile = mkOption {
|
||||
type = types.str;
|
||||
default = "~/.ssh/hermes";
|
||||
description = "SSH private key for the hermes user.";
|
||||
};
|
||||
|
||||
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 as the hermes user and
|
||||
# attach/create a Zellij session with the Hermes CLI.
|
||||
exec ssh -t -i ${cfg.identityFile} ${cfg.user}@${cfg.host} \
|
||||
"zellij attach -c ${cfg.session} || zellij -s ${cfg.session}"
|
||||
'')
|
||||
];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user