Files
nixconf/network-bond.nix
T
2026-01-25 16:54:02 +01:00

36 lines
793 B
Nix

{ config, lib, pkgs, ... }:
{
boot.kernelModules = [ "bonding" ];
networking.bonds.bond0 = {
interfaces = map (i: i.name) config.vars.interfaces;
driverOptions = {
mode = "802.3ad";
miimon = "100";
lacp_rate = "fast";
xmit_hash_policy = "layer2+3";
};
};
# 1. Generate the physical interfaces config (slaves)
# 2. Merge it with the bond0 config
networking.interfaces = lib.listToAttrs (map (iface: {
name = iface.name;
value = {
useDHCP = lib.mkForce false;
ipv4.addresses = lib.mkForce [];
};
}) config.vars.interfaces) // {
# Bond Interface Configuration
bond0 = {
useDHCP = false;
ipv4.addresses = [{
address = "192.168.178.8";
prefixLength = 24;
}];
};
};
}