From d5f96ae6e5dac549800267a2ff5e2f5f1d12011f Mon Sep 17 00:00:00 2001 From: Zynh Ludwig Date: Sun, 28 Jul 2024 14:18:38 -0700 Subject: [PATCH] ssh: refactor --- home/modules/ssh.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/home/modules/ssh.nix b/home/modules/ssh.nix index a040ea0..172f058 100644 --- a/home/modules/ssh.nix +++ b/home/modules/ssh.nix @@ -6,6 +6,8 @@ let secrets = config.sops.secrets; ifSops = lib.mkIf sops; + + keyPathIfSops = key: ifSops secrets.${key}.path; in { options.snowhawk.ssh = { @@ -25,23 +27,23 @@ in hostname = "git.zynh.me"; user = "git"; port = 2221; - identityFile = ifSops secrets."private_keys/personal_git".path; + identityFile = keyPathIfSops "private_keys/personal_git"; }; snowhawk = { - identityFile = ifSops secrets."private_keys/snowhawk".path; + identityFile = keyPathIfSops "private_keys/snowhawk"; }; msiserver = { hostname = "scarlet.zynh.me"; user = "zynh"; - identityFile = ifSops secrets."private_keys/msiserver".path; + identityFile = keyPathIfSops "private_keys/msiserver"; }; "msiserver.local" = lib.mkIf cfg.homeNetwork { hostname = "msiserver"; user = "zynh"; - identityFile = ifSops secrets."private_keys/msiserver".path; + identityFile = keyPathIfSops "private_keys/msiserver"; }; caveserver = { - identityFile = ifSops secrets."private_keys/caveserver".path; + identityFile = keyPathIfSops "private_keys/caveserver"; }; }; };