From 2b6bb2e4230cc19658ee841950404d0decf53573 Mon Sep 17 00:00:00 2001 From: Astro Date: Sun, 23 Oct 2022 01:16:39 +0200 Subject: [PATCH] pkgs/gateway-report: emphasize ipv6 default router --- nix/pkgs/gateway-report.nix | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/nix/pkgs/gateway-report.nix b/nix/pkgs/gateway-report.nix index 6304479..e9822b3 100644 --- a/nix/pkgs/gateway-report.nix +++ b/nix/pkgs/gateway-report.nix @@ -56,15 +56,17 @@ writeText "vlan-report.md" '' let hostConfig = config.site.hosts.${hostName}; isDhcpDefault = hostName == netConfig.dhcp.router or null; + emphasize = s: + if isDhcpDefault + then "**${s}**" + else s; upstream4a = upstreamAt hostConfig.ospf.allowedUpstreams 0; upstream4b = upstreamAt hostConfig.ospf.allowedUpstreams 1; in '' - |`${ - netConfig.hosts4.${hostName} - }`|${ - if isDhcpDefault - then "**${hostName}**" - else hostName + |${ + emphasize netConfig.hosts4.${hostName} + }|${ + emphasize hostName }|${ upstream4a }|${ @@ -86,17 +88,24 @@ writeText "vlan-report.md" '' ${lib.concatMapStrings (hostName: let hostConfig = config.site.hosts.${hostName}; + isIpv6Router = hostName == netConfig.ipv6Router; + emphasize = s: + if isIpv6Router + then "**${s}**" + else s; upstream6a = upstreamAt hostConfig.ospf.allowedUpstreams6 0; upstream6b = upstreamAt hostConfig.ospf.allowedUpstreams6 1; in '' |${ - lib.concatMapStringsSep " " (ctx: - "`${netConfig.hosts6.${ctx}.${hostName}}`" - ) (builtins.filter (ctx: - netConfig.hosts6.${ctx} ? ${hostName} - ) (builtins.attrNames netConfig.hosts6)) + emphasize ( + lib.concatMapStringsSep " " (ctx: + "`${netConfig.hosts6.${ctx}.${hostName}}`" + ) (builtins.filter (ctx: + netConfig.hosts6.${ctx} ? ${hostName} + ) (builtins.attrNames netConfig.hosts6)) + ) }|${ - hostName + emphasize hostName }|${ upstream6a }|${