pkgs/vlan-report: add
This commit is contained in:
parent
7b80560aed
commit
7acff4cf8e
|
@ -92,9 +92,14 @@ let
|
|||
subnetplans = import ./subnetplans.nix {
|
||||
inherit self nixpkgs system;
|
||||
};
|
||||
|
||||
vlan-report = import ./vlan-report.nix {
|
||||
inherit self nixpkgs system;
|
||||
};
|
||||
in
|
||||
rootfs-packages // vm-packages // device-templates // network-graphs // network-cypher-graphs // starlink // subnetplans // {
|
||||
inherit all-rootfs export-openwrt-models export-config dns-slaves
|
||||
encrypt-secrets decrypt-secrets switch-to-production
|
||||
vlan-report
|
||||
;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
{ self, nixpkgs, system }:
|
||||
with nixpkgs.legacyPackages.${system};
|
||||
let
|
||||
config = self.lib.config;
|
||||
in
|
||||
writeText "vlan-report.txt" (
|
||||
lib.concatMapStrings (net: ''
|
||||
## ${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)
|
||||
)}
|
||||
|
||||
'') (lib.attrNames config.site.net)
|
||||
)
|
Loading…
Reference in New Issue