I found no good summary on this, so if this has been asked before please excuse my missing search skills…
I found that I can configure NetworkManager itself (NetworkManager.conf) via configuration.nix. But it seems I cannot handle the system connections in /etc/NetworkManager/system-connections/ directly.
I also found out that I can manage files in /etc/ using environment.etc (basically copying a file to the nix store and linking it to /etc/somewhere, IIUC).
Are there any experiences on doing this for the NetworkManager system-connection files? Does this simply not work (because $REASONS) or is this a valid approach?
I do exactly that, but keep in mind that the files have to be copied in and not symlinked as they need to have mode “0600” in order for NM to accept them.
OK, how would I do that? I.e. how to copy and not symlink? environment.etc creates a link AFAIK.
Or, to paraphase the question:
Where can I find out, what options environment.etc accepts? Is the code in the Nixos git repository the only place to find this? Or is this another case of “missing search skills”?
Thanks Peter and Janik! Peter’s snippet solves this for me (for now, as i am on 23.05, but will use networking.networkmanager.ensure-profiles.profiles once this is stable).