Saving WiFi Credentials?

Hi! So I recently installed NixOS on both my desktop machine and my laptop. On my desktop machine, NetworkManager automatically reconnects to my WiFi but on my laptop, I have to re-enter the keyphrase every time I restart NetworkManager/the device.
Is this related to some setting in the UEFI that I might not have enabled on my laptop? I wouldn’t know which setting that is, but this would be the only explanation that makes sense to me because other than hardware specific settings, the configuration is identical (my desktop machine uses an intel processor and an nVidia GPU, the laptop uses an AMD CPU and its integrated graphics).

My networking config:

networking = {
  hostName = ...;
  firewall = ...;
  networkmanager.enable = true;
  useDHCP = lib.mkDefault true; 
}

There really is no device-specifig configuration concerning networking, the only such settings are microcode and graphics drivers.

I’d appreciate any help concerning this issue because I start to become annoyed by having to enter the passkey all the time, lol.

Thanks in advance!

Mmm, not sure if it helps, but NetworkManager stores wifi credentials in files like /etc/NetworkManager/system-connections/SSID.nmconnection. Maybe there’s some sort of issue in this folder, perhaps wrong permissions? Try comparing these files between your machines or delete them and try to re-add the network to see if that helps.

BTW, the file should look something like this.

[connection]
id=SSID
uuid=da8cee6a-a249-456b-8cfe-626b883636f9
type=wifi
interface-name=wlp5s0
permissions=user:YOURUSER:;

[wifi]
mode=infrastructure
ssid=SSID

[wifi-security]
auth-alg=open
key-mgmt=wpa-psk
psk=plaintext password

[ipv4]
method=auto

[ipv6]
addr-gen-mode=default
method=auto

[proxy]

Oh, wow. This was very helpful, thank you so much! For some reasaon (although permissions etc. are the same), NM never wrote such a file on my laptop; the directory was completely empty. I had to manually create it once, and now it seems to work. Thank you!