IfState
IfState is a python 3 utility designed for declarative management of Linux network interfaces. It acts as a frontend to the kernel's Netlink interface, using the pyroute2
library to configure network settings such as IP addresses, bridges, traffic control, and WireGuard in an idempotent manner—much like an iproute2
/ethtool
/tc
/wg
wrapper.
It will be probably be available with NixOS 25.11 (see https://github.com/NixOS/nixpkgs/pull/431047).
Examples
You can find several examples on the IfState website. Due to the fact that these are yaml examples, I decided to provide some nix examples here too:
{
networking.ifstate = {
enable = true;
settings = {
interfaces.enp3s0 = {
addresses = [ "192.0.2.10/24" ];
link = {
state = "up";
kind = "physical";
};
identify.address = "6b:5e:2a:c1:91:eb";
};
routing.routes = [
{
to = "0.0.0.0/0";
dev = "enp3s0";
via = "192.0.2.1";
}
];
};
};
}