From fc8aab11360cb01d4b1adc6930207fbe9d295193 Mon Sep 17 00:00:00 2001 From: xenia Date: Sat, 30 Mar 2024 20:49:20 +0100 Subject: [PATCH] Set default gateway when configuring with static IP --- nixos/networking.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nixos/networking.nix b/nixos/networking.nix index 78ff2f0e..7f9bc9b7 100644 --- a/nixos/networking.nix +++ b/nixos/networking.nix @@ -1,9 +1,11 @@ { eth-interface ? "eth0", static-ip ? false, # false, or IPv4 address + default-gateway ? "192.168.1.1", }: { networking = if static-ip != false then { + defaultGateway = { address = default-gateway; interface = eth-interface; }; useDHCP = false; interfaces.${eth-interface}.ipv4.addresses = [ { address = static-ip;