Merge remote-tracking branch 'ni/master'

This commit is contained in:
lassulus 2020-08-19 21:16:46 +02:00
commit 0b4329eb0a
8 changed files with 85 additions and 46 deletions

View file

@ -109,7 +109,6 @@ let
{
krebs.dns.providers = {
"krebsco.de" = "zones";
gg23 = "hosts";
shack = "hosts";
i = "hosts";
r = "hosts";
@ -153,9 +152,11 @@ let
let
longs = net.aliases;
shorts =
map (removeSuffix ".${cfg.dns.search-domain}")
(filter (hasSuffix ".${cfg.dns.search-domain}")
longs);
optionals
(cfg.dns.search-domain != null)
(map (removeSuffix ".${cfg.dns.search-domain}")
(filter (hasSuffix ".${cfg.dns.search-domain}")
longs));
add-port = a:
if net.ssh.port != 22
then "[${a}]:${toString net.ssh.port}"
@ -178,7 +179,8 @@ let
(concatMap (host: attrValues host.nets)
(mapAttrsToList
(_: host: recursiveUpdate host
(optionalAttrs (hasAttr cfg.dns.search-domain host.nets) {
(optionalAttrs (cfg.dns.search-domain != null &&
hasAttr cfg.dns.search-domain host.nets) {
nets."" = host.nets.${cfg.dns.search-domain} // {
aliases = [host.name];
addrs = [];

View file

@ -6,7 +6,7 @@ with import <stockholm/lib>;
};
krebs.dns.search-domain = mkOption {
type = types.hostname;
type = types.nullOr types.hostname;
};
};
}

View file

@ -24,7 +24,11 @@ in {
aliases = longs ++ shorts;
longs = filter check net.aliases;
shorts = let s = ".${config.krebs.dns.search-domain}"; in
map (removeSuffix s) (filter (hasSuffix s) longs);
optionals
(config.krebs.dns.search-domain != null)
(map (removeSuffix s)
(filter (hasSuffix s)
longs));
in
map (addr: { ${addr} = aliases; }) net.addrs)
(attrValues host.nets))

View file

@ -131,11 +131,6 @@ in {
ci = true;
cores = 2;
nets = {
gg23 = {
ip4.addr = "10.23.1.110";
aliases = ["nomic.gg23"];
ssh.port = 11423;
};
retiolum = {
ip4.addr = "10.243.0.110";
aliases = [
@ -158,27 +153,10 @@ in {
ssh.privkey.path = <secrets/ssh.id_ed25519>;
ssh.pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMIHmwXHV7E9UGuk4voVCADjlLkyygqNw054jvrsPn5t root@nomic";
};
ok = {
external = true;
nets = {
gg23 = {
ip4.addr = "10.23.1.1";
aliases = ["ok.gg23"];
};
};
};
wu = {
ci = true;
cores = 4;
nets = {
gg23 = {
ip4.addr = "10.23.1.37";
aliases = [
"wu.gg23"
"cache.wu.gg23"
];
ssh.port = 11423;
};
retiolum = {
ip4.addr = "10.243.13.37";
aliases = [
@ -237,14 +215,6 @@ in {
ci = true;
cores = 4;
nets = {
gg23 = {
ip4.addr = "10.23.1.38";
aliases = [
"xu.gg23"
"cache.xu.gg23"
];
ssh.port = 11423;
};
retiolum = {
ip4.addr = "10.243.13.38";
aliases = [
@ -272,13 +242,6 @@ in {
ci = true;
cores = 4;
nets = {
gg23 = {
ip4.addr = "10.23.1.39";
aliases = [
"zu.gg23"
];
ssh.port = 11423;
};
retiolum = {
ip4.addr = "10.243.13.40";
aliases = [

View file

@ -27,7 +27,7 @@
enable = true;
virtualHosts.nix-serve = {
serverAliases = [
"cache.${config.krebs.build.host.name}.gg23"
"cache.${config.krebs.build.host.name}.hkw"
];
locations."/".extraConfig = ''
proxy_pass http://localhost:${toString config.services.nix-serve.port};

View file

@ -16,6 +16,7 @@ with import <stockholm/lib>;
./backup.nix
./bash
./htop.nix
./nets/hkw.nix
./nginx
./pki
./ssh.nix

69
tv/2configs/nets/hkw.nix Normal file
View file

@ -0,0 +1,69 @@
{
krebs = {
dns.providers.hkw = "hosts";
hosts = {
nomic = {
nets.hkw = {
ip4 = {
addr = "10.23.1.110";
prefix = "10.23.1.0/24";
};
aliases = [
"nomic.hkw"
];
ssh.port = 11423;
};
};
ok = {
external = true;
nets.hkw = {
ip4 = {
addr = "10.23.1.1";
prefix = "10.23.1.0/24";
};
aliases = [
"ok.hkw"
];
};
};
wu = {
nets.hkw = {
ip4 = {
addr = "10.23.1.37";
prefix = "10.23.1.0/24";
};
aliases = [
"wu.hkw"
"cache.wu.hkw"
];
ssh.port = 11423;
};
};
xu = {
nets.hkw = {
ip4 = {
addr = "10.23.1.38";
prefix = "10.23.1.0/24";
};
aliases = [
"xu.hkw"
"cache.xu.hkw"
];
ssh.port = 11423;
};
};
zu = {
nets.hkw = {
ip4 = {
addr = "10.23.1.39";
prefix = "10.23.1.0/24";
};
aliases = [
"zu.hkw"
];
ssh.port = 11423;
};
};
};
};
}

View file

@ -9,7 +9,7 @@ with import <stockholm/lib>;
serverAliases = [
"localhost"
"${config.krebs.build.host.name}"
"${config.krebs.build.host.name}.gg23"
"${config.krebs.build.host.name}.hkw"
"${config.krebs.build.host.name}.r"
];
locations."~ ^/~(.+?)(/.*)?\$".extraConfig = ''