depot/modules/ssh/default.nix

15 lines
516 B
Nix
Raw Permalink Normal View History

2023-03-07 02:25:57 +02:00
{ depot, lib, ... }:
2021-06-05 23:59:06 +03:00
let
2023-08-31 01:55:45 +03:00
filtered = lib.filterAttrs (_: host: host.ssh.enable) depot.hours;
2023-03-07 02:25:57 +02:00
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;
};
}