style(nixos): separate SSH configuration sections

This commit is contained in:
2026-10-07 20:20:50 -04:00
parent fa80dc4e3e
commit bc57a924d3

View File

@@ -15,6 +15,7 @@ let
"zeus"
];
serverNames = [ "pikachu" ];
isWorkstation = lib.elem config.networking.hostName workstationNames; # NOLINT(let_order)
isServer = lib.elem config.networking.hostName serverNames; # NOLINT(let_order)
@@ -26,12 +27,14 @@ let
(../../hosts + "/${host}/ssh_host_ed25519_key.pub")
(../../hosts + "/${host}/ssh_host_rsa_key.pub")
];
# NOLINT(let_order)
managedTargets = lib.genAttrs (workstationNames ++ serverNames) (name: {
hostName = registry.address.${name}.self;
clientKey = clientKeyFor name;
hostKeys = hostKeysFor name;
});
extraTargets = {
# TODO: Pin Gitea's host key after migrating it from Proxmox.
gitea = {
@@ -44,6 +47,7 @@ let
];
};
};
# NOLINT(let_order)
mkTarget = name: target: {
hostName = target.hostName or name;
@@ -60,6 +64,7 @@ let
defaultAuthorizedKeys = lib.flatten (
clientKeysFor workstationNames ++ lib.optional isServer (clientKeysFor serverNames)
);
outboundTargetNames = # NOLINT(let_order)
let
groupTargets =
@@ -93,6 +98,7 @@ let
names = lib.unique (target.aliases ++ [ target.hostName ]);
in
map withPort names;
keyWithoutComment = key: lib.concatStringsSep " " (lib.take 2 (lib.splitString " " key));
sshSettingsFor =