home/nixos/networking.nix

15 lines
276 B
Nix

{
eth-interface ? "eth0",
static-ip ? false, # false, or IPv4 address
}:
{
networking = if static-ip != false then {
useDHCP = false;
interfaces.${eth-interface}.ipv4.addresses = [ {
address = static-ip;
prefixLength = 24;
} ];
} else {
};
}