Storing WiFi passwords with agenix using NetworkManager

Hey, I started using agenix to manage my secrets. Is there a way to manage wifi paswords with NetworkManager ?

After some research, I took a look at networking.wireless.environmentFile, but that option only works for wpa_supplicant, which I’d rather not use.

Thanks !

Yeah: NixOS Search

You can then use variables from that with $VARNAME.

I’d definitely recommend using networkmanager over raw wpa_supplicant for normal desktop devices; it’s much better at mixing declarative and nondeclarative networks. It’s also more versatile when you want to switch between networks, can easily turn on/off VPN configs, …

The main downside is that you need to write networkmanager profiles, and the file format for that is a bit underdocumented. But it’s ok as long as you don’t want to do anything too complex.

1 Like

That works for me, thank you!

For people that might need to solve the same issue, I’ve written a post on my blog: NixOS: Declarative WiFi connections with agenix and NetworkManager - tasia's website detailing my process.

4 Likes