ssh: refactor

This commit is contained in:
Zynh Ludwig 2024-07-28 14:18:38 -07:00
parent 08369e38e1
commit d5f96ae6e5

View file

@ -6,6 +6,8 @@ let
secrets = config.sops.secrets; secrets = config.sops.secrets;
ifSops = lib.mkIf sops; ifSops = lib.mkIf sops;
keyPathIfSops = key: ifSops secrets.${key}.path;
in in
{ {
options.snowhawk.ssh = { options.snowhawk.ssh = {
@ -25,23 +27,23 @@ in
hostname = "git.zynh.me"; hostname = "git.zynh.me";
user = "git"; user = "git";
port = 2221; port = 2221;
identityFile = ifSops secrets."private_keys/personal_git".path; identityFile = keyPathIfSops "private_keys/personal_git";
}; };
snowhawk = { snowhawk = {
identityFile = ifSops secrets."private_keys/snowhawk".path; identityFile = keyPathIfSops "private_keys/snowhawk";
}; };
msiserver = { msiserver = {
hostname = "scarlet.zynh.me"; hostname = "scarlet.zynh.me";
user = "zynh"; user = "zynh";
identityFile = ifSops secrets."private_keys/msiserver".path; identityFile = keyPathIfSops "private_keys/msiserver";
}; };
"msiserver.local" = lib.mkIf cfg.homeNetwork { "msiserver.local" = lib.mkIf cfg.homeNetwork {
hostname = "msiserver"; hostname = "msiserver";
user = "zynh"; user = "zynh";
identityFile = ifSops secrets."private_keys/msiserver".path; identityFile = keyPathIfSops "private_keys/msiserver";
}; };
caveserver = { caveserver = {
identityFile = ifSops secrets."private_keys/caveserver".path; identityFile = keyPathIfSops "private_keys/caveserver";
}; };
}; };
}; };