diff --git a/generate-topology.nix b/generate-topology.nix
index fff2563..6162d39 100644
--- a/generate-topology.nix
+++ b/generate-topology.nix
@@ -1,5 +1,6 @@
{
pkgs,
+ # deadnix: skip
renderer ? "graphviz",
nixosConfigurations,
}: let
@@ -9,32 +10,27 @@
attrNames
attrValues
concatLines
- concatMapStrings
concatStringsSep
- const
elem
escapeXML
flip
filterAttrs
- id
imap0
- mapAttrs
mapAttrs'
nameValuePair
mapAttrsToList
optional
optionalAttrs
optionalString
- optionals
;
- global = {
- # global entities;
- };
+ # global = {
+ # # global entities;
+ # };
- asjson = builtins.toFile "topology.dot" (
- builtins.toJSON (map (x: x.config.topology) (attrValues nixosConfigurations))
- );
+ # asjson = builtins.toFile "topology.dot" (
+ # builtins.toJSON (map (x: x.config.topology) (attrValues nixosConfigurations))
+ # );
colors.base00 = "#101419";
colors.base01 = "#171B20";
@@ -60,7 +56,7 @@
font = attrs: text: "${text}";
fontMono = {face = "JetBrains Mono";};
mono = font fontMono;
- monoColor = color: font (fontMono // {color = color;});
+ monoColor = color: font (fontMono // {inherit color;});
mkCell = cellAttrs: text: "
${text} | ";
mapToTableRows = xs: {
diff --git a/modules/topology.nix b/modules/topology.nix
index a1d4e0a..84f82d9 100644
--- a/modules/topology.nix
+++ b/modules/topology.nix
@@ -5,18 +5,14 @@
}: let
inherit
(lib)
- attrNames
- concatMap
flip
filterAttrs
- getAttrFromPath
mapAttrs
mapAttrs'
mapAttrsToList
mkMerge
mkOption
nameValuePair
- optionals
types
;
in {
@@ -100,15 +96,13 @@ in {
isNetwork = netDef: (netDef.matchConfig != {}) && (netDef.address != [] || netDef.DHCP != null);
macsByName = mapAttrs' (flip nameValuePair) (config.networking.renameInterfacesByMac or {});
netNameFor = netName: netDef:
- if netDef ? matchConfig.Name
- then netDef.matchConfig.Name
- else if netDef ? matchConfig.MACAddress && macsByName ? ${netDef.matchConfig.MACAddress}
- then macsByName.${netDef.matchConfig.MACAddress}
- else lib.trace "Could not derive network name for systemd network ${netName} on host ${config.node.name}, using unit name as fallback." netName;
- netMACFor = netDef:
- if netDef ? matchConfig.MACAddress
- then netDef.matchConfig.MACAddress
- else null;
+ netDef.matchConfig.Name
+ or (
+ if netDef ? matchConfig.MACAddress && macsByName ? ${netDef.matchConfig.MACAddress}
+ then macsByName.${netDef.matchConfig.MACAddress}
+ else lib.trace "Could not derive network name for systemd network ${netName} on host ${config.node.name}, using unit name as fallback." netName
+ );
+ netMACFor = netDef: netDef.matchConfig.MACAddress or null;
networks = filterAttrs (_: isNetwork) (config.systemd.network.networks or {});
in
flip mapAttrs' networks (netName: netDef: