2023-04-14 14:12:45 +03:00
|
|
|
{
|
|
|
|
lib,
|
2024-08-24 21:14:47 +03:00
|
|
|
config,
|
2023-04-14 14:12:45 +03:00
|
|
|
myData,
|
|
|
|
...
|
2024-07-29 15:39:54 +03:00
|
|
|
}:
|
|
|
|
{
|
2023-04-14 14:12:45 +03:00
|
|
|
config = {
|
|
|
|
services.openssh = {
|
|
|
|
enable = true;
|
|
|
|
settings = {
|
|
|
|
PasswordAuthentication = false;
|
|
|
|
PermitRootLogin = "no";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
programs.mosh.enable = true;
|
2024-08-24 21:14:47 +03:00
|
|
|
programs.ssh = {
|
|
|
|
knownHosts =
|
|
|
|
let
|
2024-11-17 10:55:36 +02:00
|
|
|
filtered = lib.filterAttrs (_key: value: lib.hasAttr "publicKey" value) myData.hosts;
|
2024-08-24 21:14:47 +03:00
|
|
|
sshAttrs = lib.genAttrs [
|
|
|
|
"extraHostNames"
|
|
|
|
"publicKey"
|
|
|
|
] (_: null);
|
|
|
|
in
|
2024-11-17 10:55:36 +02:00
|
|
|
lib.mapAttrs (_name: builtins.intersectAttrs sshAttrs) filtered;
|
2024-08-27 07:03:23 +03:00
|
|
|
extraConfig =
|
|
|
|
''
|
|
|
|
Host git.jakstys.lt
|
|
|
|
HostName ${myData.hosts."fwminex.servers.jakst".jakstIP}
|
2024-09-30 22:26:54 +03:00
|
|
|
|
2024-08-27 07:03:23 +03:00
|
|
|
''
|
2024-09-30 22:26:54 +03:00
|
|
|
+ (lib.concatMapStringsSep "\n"
|
|
|
|
(host: ''
|
|
|
|
Host ${builtins.elemAt (lib.splitString "." host) 0}
|
|
|
|
HostName ${myData.hosts.${host}.jakstIP}
|
|
|
|
'')
|
|
|
|
(
|
|
|
|
builtins.attrNames (
|
|
|
|
lib.filterAttrs (name: props: name != "fra1-b.servers.jakst" && props ? jakstIP) myData.hosts
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
2024-08-24 21:14:47 +03:00
|
|
|
};
|
2023-04-14 14:12:45 +03:00
|
|
|
};
|
|
|
|
}
|