oddlama / nix-topology

🍁 Generate infrastructure and network diagrams directly from your NixOS configurations
https://oddlama.github.io/nix-topology
MIT License
490 stars 20 forks source link

feat(extractors/interface): init #2

Closed IogaMaster closed 5 months ago

IogaMaster commented 6 months ago

Guide me through what you want done for this extractor

Right now it just shows the interfaces on the nodes.

image

oddlama commented 6 months ago

Thanks for your contribution!

Guide me through what you want done for this extractor

Anything you can come up with really :P More seriously though, I think we can start with whatever you are comfortable implementing and we can always extend it later if we find new interesting stuff. What I usually have in mind for networking is:

Just pick whatever you like.

Two additional thoughts:

IogaMaster commented 6 months ago

Okay thanks!

static ipv4/ipv6 addresses (if specified)

Im working on this rn

IogaMaster commented 6 months ago

@oddlama

known interfaces, so what you already have mac addresses (if specified) static ipv4/ipv6 addresses (if specified) interface type (ethernet / wifi / macvlan / macvtap / tun / tap / ...) you could think about setting addresses = ["DHCP"] if you know that an interface uses DHCP (maybe we'll convert that to a new information option later) anything else you can come up with, we can extend the list of extracted information. For the future I have VLANs in mind but that's probably going to need changes in the renderer too.

All are done!

I don't know what to add I will keep looking at the search.nixos.org reference

IogaMaster commented 6 months ago

image

Generated from:

  networking.interfaces.eth0 = {
    name = "eth0";
    ipv4.addresses = [
      {
        address = "192.168.25.141";
        prefixLength = 24;
      }
    ];

    ipv6.addresses = [
      {
        address = "fdfd:b3f0:482::1";
        prefixLength = 48;
      }
    ];

    macAddress = "3abansdsjh";
  };

DHCP (just remove ip addresses from config): image

IogaMaster commented 6 months ago

interface type (ethernet / wifi / macvlan / macvtap / tun / tap / ...)

This isn't done, I missed it when I read the list. whoops :smile:

IogaMaster commented 6 months ago

Also can confirm that topology.self is functional!

IogaMaster commented 6 months ago

@oddlama I don't think there is a way that we can get the interface type?

oddlama commented 6 months ago

It's just something that I did for systemd-networkd. If that information isn't available on networking.interfaces then I'd say just keep the current default (which is ethernet).

IogaMaster commented 6 months ago

I can consider this module done for now! Looking for merge!