flake.nix: pull in the zentralwerk network db

This commit is contained in:
Astro 2021-09-07 00:38:16 +02:00
parent b83aeccaa1
commit 42a32a42dc
1 changed files with 27 additions and 2 deletions

View File

@ -4,6 +4,7 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/release-21.05";
secrets.url = "git+ssh://git@gitea.c3d2.de:2222/c3d2-admins/secrets.git";
zentralwerk.url = "git+https://gitea.c3d2.de/zentralwerk/network.git";
yammat.url = "git+https://gitea.c3d2.de/astro/yammat.git?ref=nix";
yammat.inputs.nixpkgs.follows = "nixpkgs";
scrapers.url = "git+https://gitea.c3d2.de/astro/scrapers.git";
@ -12,11 +13,35 @@
tigger.flake = false;
};
outputs = { self, nixpkgs, secrets, nixos-hardware, yammat, scrapers, tigger }:
outputs = { self, nixpkgs, secrets, nixos-hardware, zentralwerk, yammat, scrapers, tigger }:
let
forAllSystems = nixpkgs.lib.genAttrs [ "aarch64-linux" "x86_64-linux" ];
hostRegistry = import ./host-registry.nix;
inherit (nixpkgs.lib) recursiveUpdate;
extractZwHosts = { hosts4, hosts6, ... }:
recursiveUpdate (
builtins.foldl' (result: name:
recursiveUpdate result {
"${name}".ip4 = hosts4.${name};
}
) {} (builtins.attrNames hosts4)
) (
builtins.foldl' (result: ctx:
builtins.foldl' (result: name:
recursiveUpdate result {
"${name}".ip6 = hosts6.${ctx}.${name};
}
) result (builtins.attrNames hosts6.${ctx})
) {} (builtins.attrNames hosts6)
);
zwHostRegistry = {
hosts =
builtins.foldl' (result: net:
recursiveUpdate result (extractZwHosts zentralwerk.lib.config.site.net.${net})
) {} [ "core" "c3d2" "serv" ];
};
extraHostRegistry = import ./host-registry.nix;
hostRegistry = nixpkgs.lib.recursiveUpdate zwHostRegistry extraHostRegistry;
in {
overlay = import ./overlay;