1
1
Fork 1
mirror of https://github.com/oddlama/nix-config.git synced 2025-10-11 07:10:39 +02:00

feat(topology): improve details readability

This commit is contained in:
oddlama 2024-04-01 16:18:45 +02:00
parent beb50045b4
commit e48cd0581b
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A
4 changed files with 14 additions and 9 deletions

View file

@ -14,6 +14,7 @@
- impermanence render? - impermanence render?
- nixos nftables firewall render? - nixos nftables firewall render?
- make colors configurable
- search todo and do - search todo and do
- the network propagator based on options.nodes cannot deal with mkMerge and mkIf stuff currently - the network propagator based on options.nodes cannot deal with mkMerge and mkIf stuff currently

View file

@ -14,6 +14,7 @@
mkDefault mkDefault
mkEnableOption mkEnableOption
mkIf mkIf
mkMerge
optional optional
replaceStrings replaceStrings
; ;
@ -76,8 +77,8 @@ in {
nginx = mkIf config.services.nginx.enable { nginx = mkIf config.services.nginx.enable {
name = "NGINX"; name = "NGINX";
icon = "services.nginx"; icon = "services.nginx";
details.reverse = let details = let
lines = flatten (flip mapAttrsToList config.services.nginx.virtualHosts ( reverseProxies = flatten (flip mapAttrsToList config.services.nginx.virtualHosts (
server: vh: server: vh:
flip mapAttrsToList vh.locations ( flip mapAttrsToList vh.locations (
path: location: let path: location: let
@ -87,11 +88,13 @@ in {
then toString (attrNames config.services.nginx.upstreams.${upstreamName}.servers) then toString (attrNames config.services.nginx.upstreams.${upstreamName}.servers)
else location.proxyPass; else location.proxyPass;
in in
optional (path == "/" && location.proxyPass != null) "${server} -> ${passTo}" optional (path == "/" && location.proxyPass != null) {
${server} = {text = passTo;};
}
) )
)); ));
in in
mkIf (lines != []) {text = concatLines lines;}; mkMerge reverseProxies;
}; };
radicale = mkIf config.services.radicale.enable { radicale = mkIf config.services.radicale.enable {

View file

@ -50,8 +50,8 @@ in {
++ concatLists ( ++ concatLists (
flip mapAttrsToList config.systemd.network.networks ( flip mapAttrsToList config.systemd.network.networks (
_unit: network: let _unit: network: let
# FIXME: TODO renameInterfacesByMac is not a standard option! # FIXME: TODO renameInterfacesByMac is not a standard option! It's not an issue here but should proabaly not be used anyway.
macToName = listToAttrs (mapAttrsToList (k: v: nameValuePair v k) config.networking.renameInterfacesByMac); macToName = listToAttrs (mapAttrsToList (k: v: nameValuePair v k) (config.networking.renameInterfacesByMac or {}));
nameFromMac = nameFromMac =
optional (network ? matchConfig.MACAddress && macToName ? ${network.matchConfig.MACAddress}) optional (network ? matchConfig.MACAddress && macToName ? ${network.matchConfig.MACAddress})

View file

@ -179,9 +179,10 @@
html html
*/ */
'' ''
<div tw="flex flex-row mt-1"> <div tw="flex flex-row flex-wrap mt-1">
<span tw="flex text-sm flex-none w-22 font-bold pl-1">${detail.name}</span> <span tw="flex text-sm flex-none min-w-16 font-bold pl-1">${detail.name}</span>
<span tw="flex text-sm grow">${detail.text}</span> <span tw="flex grow"></span>
<span tw="flex text-sm ml-4">${detail.text}</span>
</div> </div>
''; '';