forked from mirrors_public/oddlama_nix-config
chore: remove superfluous stuff
This commit is contained in:
parent
6f6fcb6726
commit
412405be3d
2 changed files with 15 additions and 25 deletions
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
pkgs,
|
pkgs,
|
||||||
|
# deadnix: skip
|
||||||
renderer ? "graphviz",
|
renderer ? "graphviz",
|
||||||
nixosConfigurations,
|
nixosConfigurations,
|
||||||
}: let
|
}: let
|
||||||
|
@ -9,32 +10,27 @@
|
||||||
attrNames
|
attrNames
|
||||||
attrValues
|
attrValues
|
||||||
concatLines
|
concatLines
|
||||||
concatMapStrings
|
|
||||||
concatStringsSep
|
concatStringsSep
|
||||||
const
|
|
||||||
elem
|
elem
|
||||||
escapeXML
|
escapeXML
|
||||||
flip
|
flip
|
||||||
filterAttrs
|
filterAttrs
|
||||||
id
|
|
||||||
imap0
|
imap0
|
||||||
mapAttrs
|
|
||||||
mapAttrs'
|
mapAttrs'
|
||||||
nameValuePair
|
nameValuePair
|
||||||
mapAttrsToList
|
mapAttrsToList
|
||||||
optional
|
optional
|
||||||
optionalAttrs
|
optionalAttrs
|
||||||
optionalString
|
optionalString
|
||||||
optionals
|
|
||||||
;
|
;
|
||||||
|
|
||||||
global = {
|
# global = {
|
||||||
# global entities;
|
# # global entities;
|
||||||
};
|
# };
|
||||||
|
|
||||||
asjson = builtins.toFile "topology.dot" (
|
# asjson = builtins.toFile "topology.dot" (
|
||||||
builtins.toJSON (map (x: x.config.topology) (attrValues nixosConfigurations))
|
# builtins.toJSON (map (x: x.config.topology) (attrValues nixosConfigurations))
|
||||||
);
|
# );
|
||||||
|
|
||||||
colors.base00 = "#101419";
|
colors.base00 = "#101419";
|
||||||
colors.base01 = "#171B20";
|
colors.base01 = "#171B20";
|
||||||
|
@ -60,7 +56,7 @@
|
||||||
font = attrs: text: "<font ${xmlAttrs attrs}>${text}</font>";
|
font = attrs: text: "<font ${xmlAttrs attrs}>${text}</font>";
|
||||||
fontMono = {face = "JetBrains Mono";};
|
fontMono = {face = "JetBrains Mono";};
|
||||||
mono = font fontMono;
|
mono = font fontMono;
|
||||||
monoColor = color: font (fontMono // {color = color;});
|
monoColor = color: font (fontMono // {inherit color;});
|
||||||
|
|
||||||
mkCell = cellAttrs: text: "<td ${xmlAttrs cellAttrs}>${text}</td>";
|
mkCell = cellAttrs: text: "<td ${xmlAttrs cellAttrs}>${text}</td>";
|
||||||
mapToTableRows = xs: {
|
mapToTableRows = xs: {
|
||||||
|
|
|
@ -5,18 +5,14 @@
|
||||||
}: let
|
}: let
|
||||||
inherit
|
inherit
|
||||||
(lib)
|
(lib)
|
||||||
attrNames
|
|
||||||
concatMap
|
|
||||||
flip
|
flip
|
||||||
filterAttrs
|
filterAttrs
|
||||||
getAttrFromPath
|
|
||||||
mapAttrs
|
mapAttrs
|
||||||
mapAttrs'
|
mapAttrs'
|
||||||
mapAttrsToList
|
mapAttrsToList
|
||||||
mkMerge
|
mkMerge
|
||||||
mkOption
|
mkOption
|
||||||
nameValuePair
|
nameValuePair
|
||||||
optionals
|
|
||||||
types
|
types
|
||||||
;
|
;
|
||||||
in {
|
in {
|
||||||
|
@ -100,15 +96,13 @@ in {
|
||||||
isNetwork = netDef: (netDef.matchConfig != {}) && (netDef.address != [] || netDef.DHCP != null);
|
isNetwork = netDef: (netDef.matchConfig != {}) && (netDef.address != [] || netDef.DHCP != null);
|
||||||
macsByName = mapAttrs' (flip nameValuePair) (config.networking.renameInterfacesByMac or {});
|
macsByName = mapAttrs' (flip nameValuePair) (config.networking.renameInterfacesByMac or {});
|
||||||
netNameFor = netName: netDef:
|
netNameFor = netName: netDef:
|
||||||
if netDef ? matchConfig.Name
|
netDef.matchConfig.Name
|
||||||
then netDef.matchConfig.Name
|
or (
|
||||||
else if netDef ? matchConfig.MACAddress && macsByName ? ${netDef.matchConfig.MACAddress}
|
if netDef ? matchConfig.MACAddress && macsByName ? ${netDef.matchConfig.MACAddress}
|
||||||
then 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;
|
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
|
netMACFor = netDef: netDef.matchConfig.MACAddress or null;
|
||||||
then netDef.matchConfig.MACAddress
|
|
||||||
else null;
|
|
||||||
networks = filterAttrs (_: isNetwork) (config.systemd.network.networks or {});
|
networks = filterAttrs (_: isNetwork) (config.systemd.network.networks or {});
|
||||||
in
|
in
|
||||||
flip mapAttrs' networks (netName: netDef:
|
flip mapAttrs' networks (netName: netDef:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue