[shared] Refactor systems
This commit is contained in:
@@ -1,33 +1,28 @@
|
||||
# /nix/store/<hash>/etc/ssh/ssh_config & /nix/store/<hash>/etc/ssh/authorized_keys
|
||||
{
|
||||
lib,
|
||||
systemConfig,
|
||||
systems,
|
||||
knownSystems,
|
||||
common,
|
||||
...
|
||||
}:
|
||||
with builtins;
|
||||
let
|
||||
allSystems = knownSystems ++ systems;
|
||||
allSystems = knownSystems // systems;
|
||||
in
|
||||
{
|
||||
programs.ssh.knownHosts = listToAttrs (
|
||||
map (system: {
|
||||
name = system.hostName;
|
||||
value = {
|
||||
extraHostNames = [
|
||||
(
|
||||
if (system ? address && system.address ? tailnet) then
|
||||
system.address.tailnet
|
||||
else
|
||||
common.tailnetAddr system.hostName
|
||||
)
|
||||
];
|
||||
publicKey = system.ssh.publicKey;
|
||||
};
|
||||
}) allSystems
|
||||
);
|
||||
programs.ssh.knownHosts = builtins.mapAttrs (hostName: system: {
|
||||
extraHostNames = [
|
||||
(
|
||||
if (system ? address && system.address ? tailnet) then
|
||||
system.address.tailnet
|
||||
else
|
||||
common.tailnetAddr hostName
|
||||
)
|
||||
];
|
||||
publicKey = system.ssh.publicKey;
|
||||
}) allSystems;
|
||||
users.users.${systemConfig.username}.openssh.authorizedKeys.keys = (
|
||||
map (system: system.ssh.publicKey) allSystems
|
||||
lib.mapAttrsToList (_hostName: system: system.ssh.publicKey) allSystems
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user