From afdd0a22f33916907dacddb08f0af07e7dc31ddb Mon Sep 17 00:00:00 2001 From: Zynh Ludwig Date: Sun, 28 Jul 2024 06:08:59 -0700 Subject: [PATCH] ssh: refactoring --- home/modules/ssh.nix | 58 +++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/home/modules/ssh.nix b/home/modules/ssh.nix index 8c1163b..a0557e6 100644 --- a/home/modules/ssh.nix +++ b/home/modules/ssh.nix @@ -11,41 +11,39 @@ in homeNetwork = lib.mkEnableOption "include local hostnames for home network devices"; }; - config = lib.mkIf cfg.enable { - programs.ssh = { - enable = true; - includes = [ - "conf.d/*" - ]; - matchBlocks = { - "git.zynh.me" = { - hostname = "git.zynh.me"; - user = "git"; - port = 2221; - identityFile = "${config.home.homeDirectory}/.ssh/personal_git"; - }; - msiserver = { - hostname = "scarlet.zynh.me"; - user = "zynh"; - identityFile = "${config.home.homeDirectory}/.ssh/msiserver"; - }; - "msiserver.local" = lib.mkIf cfg.homeNetwork { - hostname = "msiserver"; - user = "zynh"; - identityFile = "${config.home.homeDirectory}/.ssh/msiserver"; - }; - caveserver = { - identityFile = "${config.home.homeDirectory}/.ssh/caveserver"; + config = + let home = config.home.homeDirectory + "/.ssh"; + in lib.mkIf cfg.enable { + programs.ssh = { + enable = true; + includes = [ "conf.d/*" ]; + matchBlocks = { + "git.zynh.me" = { + hostname = "git.zynh.me"; + user = "git"; + port = 2221; + identityFile = "${home}/.ssh/personal_git"; + }; + msiserver = { + hostname = "scarlet.zynh.me"; + user = "zynh"; + identityFile = "${home}/.ssh/msiserver"; + }; + "msiserver.local" = lib.mkIf cfg.homeNetwork { + hostname = "msiserver"; + user = "zynh"; + identityFile = "${home}/.ssh/msiserver"; + }; + caveserver = { + identityFile = "${home}/.ssh/caveserver"; + }; }; }; - }; - sops.secrets = - let home = config.home.homeDirectory; - in lib.mkIf sops { + sops.secrets = lib.mkIf sops { "private_keys/msiserver".path = "${home}/.ssh/msiserver"; "private_keys/caveserver".path = "${home}/.ssh/caveserver"; "ssh_hosts/caveserver".path = "${home}/.ssh/conf.d/caveserver_config"; }; - }; + }; }