tv: hostDefaults -> evalHost

This commit is contained in:
tv 2022-03-18 13:50:37 +01:00
parent 5903fb0b61
commit e008a493e0

View File

@ -1,11 +1,13 @@
with import <stockholm/lib>; with import <stockholm/lib>;
{ config, ... }: let { config, ... }: let
hostDefaults = hostName: host: foldl' recursiveUpdate {} [ evalHost = hostName: hostConfig: evalSubmodule types.host [
hostConfig
{ {
name = hostName;
owner = config.krebs.users.tv; owner = config.krebs.users.tv;
} }
(optionalAttrs (host.nets?retiolum) { (optionalAttrs (hostConfig.nets?retiolum) {
nets.retiolum = { nets.retiolum = {
ip6.addr = ip6.addr =
(krebs.genipv6 "retiolum" "tv" { inherit hostName; }).address; (krebs.genipv6 "retiolum" "tv" { inherit hostName; }).address;
@ -23,14 +25,13 @@ with import <stockholm/lib>;
wireguard.pubkey = readFile pubkey-path; wireguard.pubkey = readFile pubkey-path;
}; };
}) })
host
]; ];
in { in {
dns.providers = { dns.providers = {
"viljetic.de" = "regfish"; "viljetic.de" = "regfish";
}; };
hosts = mapAttrs hostDefaults { hosts = mapAttrs evalHost {
alnus = { alnus = {
ci = true; ci = true;
cores = 2; cores = 2;