2022-01-24 21:04:11 +01:00
|
|
|
{ self, nixpkgs, system }:
|
|
|
|
with nixpkgs.legacyPackages.${system};
|
|
|
|
let
|
|
|
|
config = self.lib.config;
|
|
|
|
in
|
2022-10-22 21:02:38 +02:00
|
|
|
writeText "vlan-report.md" ''
|
|
|
|
# VLAN Report
|
|
|
|
|
|
|
|
${lib.concatMapStrings (net: ''
|
2022-01-24 21:04:11 +01:00
|
|
|
## ${net}${lib.optionalString (config.site.net.${net}.vlan != null) " (VLAN ${toString config.site.net.${net}.vlan})"}
|
|
|
|
${lib.concatStringsSep "\n" (
|
|
|
|
lib.concatMap (host:
|
|
|
|
map (target: "- ${host} -> ${target}") (
|
|
|
|
builtins.attrNames (
|
|
|
|
lib.filterAttrs (_: { nets, ... }:
|
|
|
|
lib.elem net nets
|
|
|
|
) config.site.hosts.${host}.links
|
|
|
|
)
|
|
|
|
)
|
|
|
|
) (lib.attrNames config.site.hosts)
|
|
|
|
)}
|
|
|
|
|
2022-10-22 21:02:38 +02:00
|
|
|
'') (lib.attrNames config.site.net)}
|
|
|
|
''
|