depot/modules/ssh/default.nix

15 lines
523 B
Nix
Raw Normal View History

2023-03-07 02:25:57 +02:00
{ depot, lib, ... }:
2021-06-05 23:59:06 +03:00
let
2023-03-07 02:25:57 +02:00
filtered = lib.filterAttrs (_: host: host.ssh.enable) depot.config.hours;
idCapable = lib.filterAttrs (_: host: host.ssh.id.publicKey != null) filtered;
configCapable = lib.filterAttrs (_: host: host.ssh.extraConfig != "") filtered;
2021-06-05 23:59:06 +03:00
sshHosts = lib.mapAttrs (_: host: host.ssh.id) idCapable;
sshExtras = lib.mapAttrsToList (_: host: host.ssh.extraConfig) configCapable;
in {
programs.ssh = {
knownHosts = sshHosts;
extraConfig = builtins.concatStringsSep "\n" sshExtras;
};
}