2023-06-10 10:50:53 +00:00
|
|
|
{ config, lib, ... }@attrs: let
|
|
|
|
inherit (builtins)
|
|
|
|
getAttr head mapAttrs match pathExists readDir readFile typeOf;
|
|
|
|
inherit (lib)
|
|
|
|
const hasAttrByPath mapAttrs' mkDefault mkIf optionalAttrs removeSuffix
|
|
|
|
toList;
|
|
|
|
slib = import ../../lib/pure.nix { inherit lib; };
|
|
|
|
in {
|
2015-10-01 16:56:41 +00:00
|
|
|
dns.providers = {
|
2016-02-21 19:04:45 +00:00
|
|
|
"viljetic.de" = "regfish";
|
2015-10-01 16:56:41 +00:00
|
|
|
};
|
2022-12-29 16:03:22 +00:00
|
|
|
hosts =
|
|
|
|
mapAttrs
|
|
|
|
(hostName: hostFile: let
|
|
|
|
hostSource = import hostFile;
|
|
|
|
hostConfig = getAttr (typeOf hostSource) {
|
2023-06-10 10:50:53 +00:00
|
|
|
lambda = hostSource attrs;
|
2022-12-29 16:03:22 +00:00
|
|
|
set = hostSource;
|
2021-01-23 13:42:26 +00:00
|
|
|
};
|
2023-06-10 10:50:53 +00:00
|
|
|
in slib.evalSubmodule slib.types.host [
|
2022-12-29 16:33:07 +00:00
|
|
|
hostConfig
|
|
|
|
{
|
|
|
|
name = hostName;
|
|
|
|
owner = config.krebs.users.tv;
|
|
|
|
}
|
|
|
|
(optionalAttrs (hasAttrByPath ["nets" "retiolum"] hostConfig) {
|
|
|
|
nets.retiolum = {
|
|
|
|
ip6.addr =
|
2023-06-10 10:50:53 +00:00
|
|
|
(slib.krebs.genipv6 "retiolum" "tv" { inherit hostName; }).address;
|
2022-12-29 16:33:07 +00:00
|
|
|
};
|
|
|
|
})
|
|
|
|
(let
|
|
|
|
pubkey-path = ./wiregrill + "/${hostName}.pub";
|
|
|
|
in optionalAttrs (pathExists pubkey-path) {
|
|
|
|
nets.wiregrill = {
|
|
|
|
aliases = [
|
|
|
|
"${hostName}.w"
|
|
|
|
];
|
|
|
|
ip6.addr =
|
2023-06-10 10:50:53 +00:00
|
|
|
(slib.krebs.genipv6 "wiregrill" "tv" { inherit hostName; }).address;
|
2022-12-29 16:33:07 +00:00
|
|
|
wireguard.pubkey = readFile pubkey-path;
|
|
|
|
};
|
|
|
|
})
|
|
|
|
(host: mkIf (host.config.ssh.pubkey != null) {
|
|
|
|
ssh.privkey = mapAttrs (const mkDefault) {
|
2023-09-11 13:31:13 +00:00
|
|
|
path = "${config.krebs.secret.directory}/ssh.id_${host.config.ssh.privkey.type}";
|
2023-06-10 10:50:53 +00:00
|
|
|
type = head (toList (builtins.match "ssh-([^ ]+) .*" host.config.ssh.pubkey));
|
2022-12-29 16:33:07 +00:00
|
|
|
};
|
|
|
|
})
|
|
|
|
])
|
|
|
|
(mapAttrs'
|
|
|
|
(name: type: {
|
|
|
|
name = removeSuffix ".nix" name;
|
|
|
|
value = ./hosts + "/${name}";
|
|
|
|
})
|
|
|
|
(readDir ./hosts));
|
2017-08-01 09:27:27 +00:00
|
|
|
sitemap = {
|
|
|
|
"http://cgit.krebsco.de" = {
|
|
|
|
desc = "Git repositories";
|
|
|
|
};
|
2022-12-09 17:38:06 +00:00
|
|
|
"http://krebs.ni.r" = {
|
2017-08-01 09:27:27 +00:00
|
|
|
desc = "krebs-pages mirror";
|
|
|
|
};
|
|
|
|
};
|
2016-07-03 18:34:51 +00:00
|
|
|
users = {
|
2016-07-17 17:55:38 +00:00
|
|
|
dv = {
|
|
|
|
mail = "dv@alnus.r";
|
|
|
|
};
|
2017-11-02 20:12:27 +00:00
|
|
|
itak = {
|
|
|
|
};
|
2017-05-06 08:23:11 +00:00
|
|
|
mv-ni = {
|
|
|
|
mail = "mv@ni.r";
|
2015-11-06 18:45:50 +00:00
|
|
|
pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGer9e2+Lew7vnisgBbsFNECEIkpNJgEaqQqgb9inWkQ mv@vod";
|
2015-10-01 16:56:41 +00:00
|
|
|
};
|
|
|
|
tv = {
|
2016-05-21 07:52:25 +00:00
|
|
|
mail = "tv@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mJrBo0cLQ/LupQzVxGDgm3awSMPxsZAN45PSWz76zzxdDa1MMo51do+VJHfs7Wl0NcXAQrniOBYL9Wqt0qNkn1gY5smkkISGeQ/vxNap4MmzeZE7b5fpOy+2fpcRVQLpc4nooQzJvSVTFz+25lgZ6iHf45K87gQFMIAri1Pf/EDDpL87az+bRWvWi+BA2kMe1kf+Ay1LyMz8r+g51H0ma0bNFh6+fbWMfUiD9JCepIObclnUJ4NlWfcgHxTf17d/4tl6z4DTcLpCCk8Da77JouSHgvtcRbRlFV1OfhWZLXUsrlfpaQTiItv6TGIr3k7+7b66o3Qw/GQVs5GmYifaIZIz8n8my4XjkaMBd0SZfBzzvFjHMq6YUP9+SbjvReqofuoO+5tW1wTYZXitFFBfwuHlXm6w77K5QDBW6olT7pat41/F5eGxLcz tv@wu";
|
2016-03-31 01:48:43 +00:00
|
|
|
uid = 1337; # TODO use default and document what has to be done (for vv)
|
2015-11-06 18:45:50 +00:00
|
|
|
};
|
2016-02-07 04:17:07 +00:00
|
|
|
tv-nomic = {
|
2016-07-03 18:34:51 +00:00
|
|
|
inherit (config.krebs.users.tv) mail;
|
2015-11-06 18:45:50 +00:00
|
|
|
pubkey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC3dYR/n4Yw8OsYmfR2rSUG7o10G6AqOlSJHuHSEmANbMkqjiWl1TnpORtt5bAktyAGI4vWf9vhNEnxuIqGXWSV+3yCd7yfBHR1m0Y9QSw6blQ0xc1venl3JU0kpEyJfUn8a9cdXlnRiS0MP1gcsN7Zk8cqBELJYJajkSEnsT4eVaU5/wdnyzUO1fk8D8tFBJbF/tsWDLJPu4P18rpxq4wZgA2qmyHoVDEVlrz2OYcziXT6gpG0JGnToteaNg9ok5QavEYFpp8P+k1AacrBjc1PAb4MaMX1nfkSyaZwSqLdH35XkNRgPhVVmqZ5PlG3VeNpPSwpdcKi8P3zH1xG9g6Usx1SAyvcoAyGHdOwmFuA2tc1HgYEiQ+OsPrHZHujBOOZsKT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ul/P4llk0ktTpb9LoHk2+oooTH5ZuuT/8yF8J4stZt7EIOH+mSOAXG1z0BwnEkQu7pVKwu/oOZpGJTvBrGwww== tv@xu";
|
2015-10-01 16:56:41 +00:00
|
|
|
};
|
2016-03-31 01:48:43 +00:00
|
|
|
vv = {
|
|
|
|
mail = "vv@mu.r";
|
|
|
|
uid = 2000; # TODO use default
|
|
|
|
};
|
2015-10-01 16:56:41 +00:00
|
|
|
};
|
|
|
|
}
|