diff --git a/nixos/hw/c4130.nix b/nixos/hw/c4130.nix index c8ce0ed8..a3c873d3 100644 --- a/nixos/hw/c4130.nix +++ b/nixos/hw/c4130.nix @@ -5,6 +5,7 @@ ... }: let inherit (lib.modules) mkIf mkMerge; + enableBridge = true; in { imports = [ ./headless.nix @@ -13,14 +14,18 @@ in { boot = { initrd = { - systemd.network = mkIf config.networking.useNetworkd { - networks."40-eno1" = { - inherit (config.boot.initrd.systemd.network.links.eno1) matchConfig; - inherit (config.systemd.network.networks."40-eno1") address gateway DHCP networkConfig linkConfig; + systemd.network = let + inherit (config.systemd) network; + in mkIf config.networking.useNetworkd { + networks = { + eno1 = { + inherit (config.boot.initrd.systemd.network.links."10-eno1") matchConfig; + inherit (network.networks.eno1) address gateway DHCP networkConfig linkConfig; + }; }; - links.eno1 = { + links."10-eno1" = { matchConfig = { - inherit (config.systemd.network.links.eno1.matchConfig) Type MACAddress; + inherit (network.links."10-eno1".matchConfig) Type MACAddress; }; }; }; @@ -31,6 +36,42 @@ in { }; }; + systemd.network = let + inherit (config.systemd) network; + in { + networks = { + br = mkIf enableBridge { + matchConfig.Name = "br"; + DHCP = "no"; + linkConfig = { + RequiredForOnline = false; + Multicast = true; + }; + networkConfig = { + IPv6AcceptRA = false; + MulticastDNS = true; + }; + }; + eno2 = { + inherit (network.links."10-eno2") matchConfig; + bridge = mkIf enableBridge ["br"]; + linkConfig = { + RequiredForOnline = false; + #ActivationPolicy = mkIf (!enableBridge) "manual"; + }; + }; + }; + netdevs = { + br = mkIf enableBridge { + netdevConfig = { + Name = "br"; + Kind = "bridge"; + inherit (network.links."10-eno2".matchConfig) MACAddress; + }; + }; + }; + }; + environment.systemPackages = [ pkgs.ipmitool ]; diff --git a/systems/gengetsu/hardware-configuration.nix b/systems/gengetsu/hardware-configuration.nix index c5396e9a..9ce7fdde 100644 --- a/systems/gengetsu/hardware-configuration.nix +++ b/systems/gengetsu/hardware-configuration.nix @@ -25,8 +25,8 @@ networking.useNetworkd = true; systemd.network = { - networks."40-eno1" = { - inherit (config.systemd.network.links.eno1) matchConfig; + networks.eno1 = { + inherit (config.systemd.network.links."10-eno1") matchConfig; address = ["10.1.1.61/24"]; gateway = ["10.1.1.1"]; DHCP = "no"; @@ -37,10 +37,18 @@ Multicast = true; }; }; - links.eno1 = { - matchConfig = { - Type = "ether"; - MACAddress = "54:48:10:f3:fe:aa"; + links = { + "10-eno1" = { + matchConfig = { + Type = "ether"; + MACAddress = "54:48:10:f3:fe:aa"; + }; + }; + "10-eno2" = { + matchConfig = { + Type = "ether"; + MACAddress = "54:48:10:f3:fe:ac"; + }; }; }; }; diff --git a/systems/mugetsu/hardware-configuration.nix b/systems/mugetsu/hardware-configuration.nix index df890f3f..7e7637ec 100644 --- a/systems/mugetsu/hardware-configuration.nix +++ b/systems/mugetsu/hardware-configuration.nix @@ -20,8 +20,8 @@ networking.useNetworkd = true; systemd.network = { - networks."40-eno1" = { - inherit (config.systemd.network.links.eno1) matchConfig; + networks.eno1 = { + inherit (config.systemd.network.links."10-eno1") matchConfig; address = ["10.1.1.60/24"]; gateway = ["10.1.1.1"]; DHCP = "no"; @@ -32,10 +32,18 @@ Multicast = true; }; }; - links.eno1 = { - matchConfig = { - Type = "ether"; - MACAddress = "64:00:6a:c0:a1:4c"; + links = { + "10-eno1" = { + matchConfig = { + Type = "ether"; + MACAddress = "64:00:6a:c0:a1:4c"; + }; + }; + "10-eno2" = { + matchConfig = { + Type = "ether"; + MACAddress = "64:00:6a:c0:a1:4e"; + }; }; }; };