chore: remove superfluous stuff

This commit is contained in:
oddlama 2024-01-14 13:02:38 +01:00
parent 6f6fcb6726
commit 412405be3d
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A
2 changed files with 15 additions and 25 deletions

View file

@ -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: "<font ${xmlAttrs attrs}>${text}</font>";
fontMono = {face = "JetBrains Mono";};
mono = font fontMono;
monoColor = color: font (fontMono // {color = color;});
monoColor = color: font (fontMono // {inherit color;});
mkCell = cellAttrs: text: "<td ${xmlAttrs cellAttrs}>${text}</td>";
mapToTableRows = xs: {

View file

@ -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: