From e054c8b3b94b0c1380e22a4865e9e2a48ac3ee27 Mon Sep 17 00:00:00 2001 From: Sean Buckley Date: Tue, 21 Dec 2021 00:39:24 -0500 Subject: [PATCH] morph: update SSH configs --- lib/morph.nix | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/morph.nix b/lib/morph.nix index 124e5eb..addcadd 100644 --- a/lib/morph.nix +++ b/lib/morph.nix @@ -22,11 +22,18 @@ let (builtins.attrNames nixosConfigurations) ); + hostSshConfigs = concatMapStrings + (hostName: '' + Host ${hostName} + User root + HostName ${nixosConfigurations.${hostName}.config.sconfig.morph.deployment.targetHost} + '') + (builtins.attrNames nixosConfigurations); + sshConfig = pkgs.writeText "ssh_config" '' - Host * - User root StrictHostKeyChecking yes GlobalKnownHostsFile ${sshKnownHostsTxt} + ${hostSshConfigs} ''; sh = scriptBody: pkgs.writeShellScriptBin "run" '' @@ -44,8 +51,8 @@ in pkgs.mkShell { buildInputs = [ pkgs.morph ]; shellHook = '' - export IN_NIX_SHELL=impure export SSH_CONFIG_FILE=${sshConfig} + alias ssh='ssh -F${sshConfig}' ''; };