From 8dd5a331714e0b724c99dc72799d5d979b931d01 Mon Sep 17 00:00:00 2001 From: Nathan McCarty Date: Thu, 11 May 2023 11:31:17 -0400 Subject: [PATCH] Factor out ssh module --- home-manager/common/programs/core.nix | 60 ------------------------- home-manager/common/programs/ssh.nix | 65 +++++++++++++++++++++++++++ home-manager/darwin/default.nix | 1 + home-manager/linux/default.nix | 1 + 4 files changed, 67 insertions(+), 60 deletions(-) create mode 100644 home-manager/common/programs/ssh.nix diff --git a/home-manager/common/programs/core.nix b/home-manager/common/programs/core.nix index c457d23..40bbaf3 100644 --- a/home-manager/common/programs/core.nix +++ b/home-manager/common/programs/core.nix @@ -67,66 +67,6 @@ with lib; { tmate ]; }) - (mkIf config.nathan.programs.util.ssh { - ######################### - ## SSH Configuration - ######################### - programs.ssh = { - # SSH configuration - enable = true; - # extra config to set the ciphers - extraConfig = '' - Ciphers aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr - ''; - # Enable compression - compression = true; - # enable session reuse - controlMaster = "auto"; - controlPersist = "10m"; - # Configure known hosts - matchBlocks = { - "levitation" = { - forwardAgent = true; - user = "nathan"; - hostname = "100.95.223.6"; - }; - "perception" = { - forwardAgent = true; - user = "nathan"; - hostname = "100.121.150.78"; - }; - "oracles" = { - forwardAgent = true; - user = "nathan"; - hostname = "100.66.15.34"; - }; - "tounge" = { - forwardAgent = true; - user = "nathan"; - hostname = "100.75.37.98"; - }; - "shadowchild" = { - forwardAgent = true; - user = "nathan"; - hostname = "172.23.217.149"; - }; - "matrix.community.rs" = { - forwardAgent = true; - user = "nathan"; - hostname = "100.113.74.107"; - }; - "fusion" = { - forwardAgent = true; - user = "nathan"; - hostname = "100.99.69.14"; - }; - "de1955" = { - user = "de1955"; - hostname = "de1955.rsync.net"; - }; - }; - }; - }) (mkIf config.nathan.programs.util.fish { ######################### ## Fish Configuration diff --git a/home-manager/common/programs/ssh.nix b/home-manager/common/programs/ssh.nix new file mode 100644 index 0000000..7cafdbb --- /dev/null +++ b/home-manager/common/programs/ssh.nix @@ -0,0 +1,65 @@ +{ config, lib, pkgs, inputs, ... }: +with lib; { + config = mkMerge [ + (mkIf config.nathan.programs.util.ssh { + ######################### + ## SSH Configuration + ######################### + programs.ssh = { + # SSH configuration + enable = true; + # extra config to set the ciphers + extraConfig = '' + Ciphers aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr + ''; + # Enable compression + compression = true; + # enable session reuse + controlMaster = "auto"; + controlPersist = "10m"; + # Configure known hosts + matchBlocks = { + "levitation" = { + forwardAgent = true; + user = "nathan"; + hostname = "100.95.223.6"; + }; + "perception" = { + forwardAgent = true; + user = "nathan"; + hostname = "100.121.150.78"; + }; + "oracles" = { + forwardAgent = true; + user = "nathan"; + hostname = "100.66.15.34"; + }; + "tounge" = { + forwardAgent = true; + user = "nathan"; + hostname = "100.75.37.98"; + }; + "shadowchild" = { + forwardAgent = true; + user = "nathan"; + hostname = "172.23.217.149"; + }; + "matrix.community.rs" = { + forwardAgent = true; + user = "nathan"; + hostname = "100.113.74.107"; + }; + "fusion" = { + forwardAgent = true; + user = "nathan"; + hostname = "100.99.69.14"; + }; + "de1955" = { + user = "de1955"; + hostname = "de1955.rsync.net"; + }; + }; + }; + }) + ]; +} diff --git a/home-manager/darwin/default.nix b/home-manager/darwin/default.nix index 21910b2..d8e93ef 100644 --- a/home-manager/darwin/default.nix +++ b/home-manager/darwin/default.nix @@ -13,6 +13,7 @@ with nLib; { ../common/programs/devel.nix ../common/programs/terminal.nix ../common/programs/git.nix + ../common/programs/ssh.nix ./programs/core.nix ./programs/emacs.nix ./programs/devel.nix diff --git a/home-manager/linux/default.nix b/home-manager/linux/default.nix index b1414df..1ddf658 100644 --- a/home-manager/linux/default.nix +++ b/home-manager/linux/default.nix @@ -13,6 +13,7 @@ with nLib; { ../common/programs/devel.nix ../common/programs/terminal.nix ../common/programs/git.nix + ../common/programs/ssh.nix ./programs/sway.nix ./programs/communications.nix ./programs/devel.nix