2023-10-21 12:56:02 +02:00
|
|
|
{
|
|
|
|
eth-interface ? "eth0",
|
|
|
|
static-ip ? false, # false, or IPv4 address
|
2024-03-30 20:49:20 +01:00
|
|
|
default-gateway ? "192.168.1.1",
|
2023-10-21 12:56:02 +02:00
|
|
|
}:
|
|
|
|
{
|
|
|
|
networking = if static-ip != false then {
|
2024-03-30 20:49:20 +01:00
|
|
|
defaultGateway = { address = default-gateway; interface = eth-interface; };
|
2023-10-21 12:56:02 +02:00
|
|
|
useDHCP = false;
|
|
|
|
interfaces.${eth-interface}.ipv4.addresses = [ {
|
|
|
|
address = static-ip;
|
|
|
|
prefixLength = 24;
|
|
|
|
} ];
|
|
|
|
} else {
|
|
|
|
};
|
|
|
|
}
|