fix: hermes-remote uses hermes user with ~/.ssh/hermes identity
This commit is contained in:
@@ -15,7 +15,19 @@ in {
|
|||||||
host = mkOption {
|
host = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "m3-hermes";
|
default = "m3-hermes";
|
||||||
description = "SSH hostname (must match a matchBlocks entry).";
|
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 {
|
session = mkOption {
|
||||||
@@ -28,9 +40,10 @@ in {
|
|||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
home.packages = [
|
home.packages = [
|
||||||
(pkgs.writeShellScriptBin "hermes-remote" ''
|
(pkgs.writeShellScriptBin "hermes-remote" ''
|
||||||
# hermes-remote — SSH into m3-hermes and attach/create a Zellij session with hermes CLI.
|
# hermes-remote — SSH into m3-hermes as the hermes user and
|
||||||
# Uses -t for PTY allocation (required by both Zellij and Hermes).
|
# attach/create a Zellij session with the Hermes CLI.
|
||||||
exec ssh -t ${cfg.host} "zellij attach -c ${cfg.session} || zellij -s ${cfg.session}"
|
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