mirror of https://gitlab.crans.org/nounous/nixos
feat: known hosts via les infos.nix
parent
41da111000
commit
ab370ae9fb
|
|
@ -3,6 +3,7 @@
|
||||||
description = "Serveur de stockage ceph";
|
description = "Serveur de stockage ceph";
|
||||||
id = 3;
|
id = 3;
|
||||||
|
|
||||||
|
enable = true;
|
||||||
# Sous Nix mais dans une autre branche
|
# Sous Nix mais dans une autre branche
|
||||||
isDebian = true;
|
isDebian = true;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,19 @@
|
||||||
{ ... }:
|
{
|
||||||
|
infra,
|
||||||
|
lib,
|
||||||
|
hosts,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
inherit (lib)
|
||||||
|
attrNames
|
||||||
|
concatMap
|
||||||
|
optional
|
||||||
|
mapAttrs'
|
||||||
|
mkIf
|
||||||
|
nameValuePair
|
||||||
|
;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
services.openssh = {
|
services.openssh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
@ -7,5 +21,34 @@
|
||||||
settings = {
|
settings = {
|
||||||
PermitRootLogin = "yes";
|
PermitRootLogin = "yes";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# knownHosts :
|
||||||
|
# {
|
||||||
|
# "host" = {
|
||||||
|
# hostNames = ["host.adm.crans.org" 172.16.10.2 …]
|
||||||
|
# publicKey = "ssh-ed25519…"
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
knownHosts = mapAttrs' (
|
||||||
|
n: conf:
|
||||||
|
nameValuePair n (
|
||||||
|
mkIf (conf.publicSsh != null) {
|
||||||
|
publicKey = conf.publicSsh;
|
||||||
|
|
||||||
|
hostNames = [
|
||||||
|
"${n}.adm.crans.org"
|
||||||
|
]
|
||||||
|
++ concatMap (
|
||||||
|
vlan:
|
||||||
|
let
|
||||||
|
netv = conf.networking.${vlan};
|
||||||
|
in
|
||||||
|
optional (netv.enable && (netv.ipv4.address or null) != null) netv.ipv4.address
|
||||||
|
++ optional (netv.enable && (netv.ipv6.address or null) != null) netv.ipv6.address
|
||||||
|
) (attrNames infra.vlans);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
) hosts;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ in
|
||||||
example = true;
|
example = true;
|
||||||
description = "Activer la configuration Crans par défaut";
|
description = "Activer la configuration Crans par défaut";
|
||||||
# On n’utilise pas mkEnableOption pour forcer la définition de enable à true
|
# On n’utilise pas mkEnableOption pour forcer la définition de enable à true
|
||||||
# ou false (et limiter les oublis)
|
# ou false (et limiter les oublis).
|
||||||
};
|
};
|
||||||
config = mkIf config.enable {
|
config = mkIf config.enable {
|
||||||
homeNounou.enable = mkDefault true;
|
homeNounou.enable = mkDefault true;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue