Setting static ip over wifi

Relevant part of my config:

 # Networking
  networking.useDHCP = false;
  networking.interfaces.enp0s25.useDHCP = false; // Ethernet isn't plugged in 
  networking.interfaces.wlp3s0.useDHCP = false;
  networking.interfaces.wlp3s0.ipv4.addresses = [ {
    address = "192.168.0.183";
    prefixLength = 24;
  } ];
  networking.defaultGateway = "192.168.0.1";
  networking.nameservers = ["8.8.8.8"];
  networking.hostName = "nixos"; # Define your hostname.
  networking.networkmanager.enable = true; # Enable nmcli / wifi

This doesn’t work though in setting my ip address to 192.168.0.183…

Instead it’s the same as before 192.168.0.104. Yes I rebooted. What am I doing wrong and how can I learn how to overcome this without help next time?

1 Like

Is it possible that because you are enabling Network Manager your IP address is coming from there? If that is the case, I think you would need to set the static IP inside network manager.

I have never setup a wifi connection declaritively but I am guessing if you would prefer that instead you would need to also setup the wifi connection declaritively using networking.supplicant or something similar.

Hopefully someone with more experience can come along and confirm or deny this theory.

Did you manage to get this working? If so, I’d like to know the current set-up as I am struggling with the same issue.

What @dalto said is correct. This is because you are enabling network manager, and also trying to set the IP directly using the ip command (this is how the nixos network config works under the hood).

With network manager enabled, you should imagine that nm owns all interfaces, so you need to configure them through nm

I don’t see where in networking.supplicant you can set static IPs: NixOS Search