fix: add public hostname to ssh config and refactor
This commit is contained in:
@@ -18,8 +18,20 @@ in
|
||||
enable = true;
|
||||
enableDefaultConfig = false;
|
||||
|
||||
matchBlocks = lib.genAttrs hostsWithKeys (hostname: {
|
||||
host = hostname;
|
||||
});
|
||||
matchBlocks = lib.genAttrs hostsWithKeys (
|
||||
hostname:
|
||||
let
|
||||
hostConfig = outputs.nixosConfigurations.${hostname}.config;
|
||||
publicHostname = hostConfig.ssh.publicHostname;
|
||||
targetUser = hostConfig.ssh.username;
|
||||
in
|
||||
{
|
||||
host = hostname;
|
||||
user = targetUser;
|
||||
}
|
||||
// lib.optionalAttrs (publicHostname != "") {
|
||||
hostname = publicHostname;
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user