morph: update SSH configs

This commit is contained in:
Sean Buckley 2021-12-21 00:39:24 -05:00
parent b94155d641
commit e054c8b3b9

View file

@ -22,11 +22,18 @@ let
(builtins.attrNames nixosConfigurations) (builtins.attrNames nixosConfigurations)
); );
sshConfig = pkgs.writeText "ssh_config" '' hostSshConfigs = concatMapStrings
Host * (hostName: ''
Host ${hostName}
User root User root
HostName ${nixosConfigurations.${hostName}.config.sconfig.morph.deployment.targetHost}
'')
(builtins.attrNames nixosConfigurations);
sshConfig = pkgs.writeText "ssh_config" ''
StrictHostKeyChecking yes StrictHostKeyChecking yes
GlobalKnownHostsFile ${sshKnownHostsTxt} GlobalKnownHostsFile ${sshKnownHostsTxt}
${hostSshConfigs}
''; '';
sh = scriptBody: pkgs.writeShellScriptBin "run" '' sh = scriptBody: pkgs.writeShellScriptBin "run" ''
@ -44,8 +51,8 @@ in
pkgs.mkShell { pkgs.mkShell {
buildInputs = [ pkgs.morph ]; buildInputs = [ pkgs.morph ];
shellHook = '' shellHook = ''
export IN_NIX_SHELL=impure
export SSH_CONFIG_FILE=${sshConfig} export SSH_CONFIG_FILE=${sshConfig}
alias ssh='ssh -F${sshConfig}'
''; '';
}; };