diff options
author | makefu <github@syntax-fehler.de> | 2019-01-21 11:17:36 +0100 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2019-01-21 11:17:36 +0100 |
commit | 93f1ce72844bf2bc63cd919c38c3323a6f8f14ef (patch) | |
tree | 8c2f5d6da31608387a69fea93355b8f1ecd326ef /krebs/3modules/retiolum-hosts.nix | |
parent | 6af865b1e6bba605f11f5d4c6cfb7e92b4f01666 (diff) | |
parent | af0463b23493d8c31ce725beb8ff5a2fd0398001 (diff) |
Merge branch 'master' of http://cgit.ni/stockholm
Diffstat (limited to 'krebs/3modules/retiolum-hosts.nix')
-rw-r--r-- | krebs/3modules/retiolum-hosts.nix | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/krebs/3modules/retiolum-hosts.nix b/krebs/3modules/retiolum-hosts.nix new file mode 100644 index 000000000..ddf85ead7 --- /dev/null +++ b/krebs/3modules/retiolum-hosts.nix @@ -0,0 +1,28 @@ +with import <stockholm/lib>; +{ config, ... }: let + # TODO dedup functions with ./hosts.nix + check = hostname: any (domain: hasSuffix ".${domain}" hostname) domains; + domains = attrNames (filterAttrs (_: eq "hosts") config.krebs.dns.providers); +in { + nixpkgs.config.packageOverrides = super: { + retiolum-hosts = + super.writeText "retiolum-hosts" '' + ${ + concatStringsSep + "\n" + (flatten + (map + (host: let + net = host.nets.retiolum; + aliases = longs; + longs = filter check net.aliases; + in + optionals + (aliases != []) + (map (addr: "${addr} ${toString aliases}") net.addrs)) + (filter (host: hasAttr "retiolum" host.nets) + (attrValues config.krebs.hosts)))) + } + ''; + }; +} |