ssh: use ssh dir instead of homedir

This commit is contained in:
Zynh Ludwig 2024-07-28 06:11:49 -07:00
parent afdd0a22f3
commit 6bb530e404

View file

@ -12,7 +12,7 @@ in
}; };
config = config =
let home = config.home.homeDirectory + "/.ssh"; let sshDir = config.home.homeDirectory + "/.ssh";
in lib.mkIf cfg.enable { in lib.mkIf cfg.enable {
programs.ssh = { programs.ssh = {
enable = true; enable = true;
@ -22,28 +22,29 @@ in
hostname = "git.zynh.me"; hostname = "git.zynh.me";
user = "git"; user = "git";
port = 2221; port = 2221;
identityFile = "${home}/.ssh/personal_git"; identityFile = "${sshDir}/personal_git";
}; };
msiserver = { msiserver = {
hostname = "scarlet.zynh.me"; hostname = "scarlet.zynh.me";
user = "zynh"; user = "zynh";
identityFile = "${home}/.ssh/msiserver"; identityFile = "${sshDir}/msiserver";
}; };
"msiserver.local" = lib.mkIf cfg.homeNetwork { "msiserver.local" = lib.mkIf cfg.homeNetwork {
hostname = "msiserver"; hostname = "msiserver";
user = "zynh"; user = "zynh";
identityFile = "${home}/.ssh/msiserver"; identityFile = "${sshDir}/msiserver";
}; };
caveserver = { caveserver = {
identityFile = "${home}/.ssh/caveserver"; identityFile = "${sshDir}/caveserver";
}; };
}; };
}; };
sops.secrets = lib.mkIf sops { sops.secrets = ifSops {
"private_keys/msiserver".path = "${home}/.ssh/msiserver"; "private_keys/msiserver" = { };
"private_keys/caveserver".path = "${home}/.ssh/caveserver"; "private_keys/caveserver" = { };
"ssh_hosts/caveserver".path = "${home}/.ssh/conf.d/caveserver_config";
"ssh_hosts/caveserver".path = "${sshDir}/conf.d/caveserver_config";
}; };
}; };
} }