2017-11-30 21:35:04 +00:00
|
|
|
with import <stockholm/lib>;
|
2022-08-14 23:43:57 +00:00
|
|
|
{ config, pkgs, ... }: {
|
2017-11-30 21:35:04 +00:00
|
|
|
|
|
|
|
config = {
|
2022-08-14 23:43:57 +00:00
|
|
|
environment.etc =
|
2017-11-30 21:35:04 +00:00
|
|
|
mapAttrs'
|
2022-08-14 23:43:57 +00:00
|
|
|
(name: pkg: {
|
2017-11-30 21:35:04 +00:00
|
|
|
name = "zones/${name}";
|
2022-08-14 23:43:57 +00:00
|
|
|
value.source = pkg;
|
2017-11-30 21:35:04 +00:00
|
|
|
})
|
2022-08-14 23:43:57 +00:00
|
|
|
pkgs.krebs.zones;
|
|
|
|
|
|
|
|
nixpkgs.overlays = [
|
|
|
|
# Explicit zones generated from config.krebs.hosts.*.extraZones
|
|
|
|
(self: super: let
|
|
|
|
stripEmptyLines = s: (concatStringsSep "\n"
|
|
|
|
(remove "\n" (remove "" (splitString "\n" s)))) + "\n";
|
|
|
|
all-zones = foldAttrs (sum: current: sum + "\n" + current) ""
|
|
|
|
([config.krebs.zone-head-config] ++ combined-hosts);
|
|
|
|
combined-hosts =
|
|
|
|
mapAttrsToList (name: getAttr "extraZones") config.krebs.hosts;
|
|
|
|
in {
|
|
|
|
krebs = super.krebs or {} // {
|
|
|
|
zones = super.krebs.zones or {} //
|
|
|
|
mapAttrs'
|
|
|
|
(name: value: {
|
|
|
|
name = name;
|
|
|
|
value = self.writeText "${name}.zone" (stripEmptyLines value);
|
|
|
|
})
|
|
|
|
all-zones;
|
|
|
|
};
|
|
|
|
})
|
|
|
|
];
|
2017-11-30 21:35:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|