I am able to correctly switch the vpn on by typing sudo openvpn my/path/to/myvpn.ovpn followed by username & password.
The question is: is there a way to edit my configuration in such a way that myvpn appears in my gnome network manager, and can be switched on/off via network manager?
There’s nothing wrong with creating files in the format that NetworkManager expects (it’s just ini files). I’m doing that to generate different configurations for when I’m on-site with various customers.
Take a look in /etc/NetworkManager/system-connections.
One thing to keep in mind is that NM needs the permissions to be 0600, so you cannot link them to the store, but instead copy them into place:
Yes I found the .nmconnection file in the folder you indicated, after manually configuring the vpn on network manager.
Can you please explain a little more? Unfortunately I am no expert at all in nixos language. I guess the line you posted should stay inside my configuration.nix and provide network manager the right permissions. Next thing I guess I need to do is to copy the test of the .nmconfiguration file into another file somewhere into my $HOME. But then, how to tell network manager where to look to find it?
2 Can you please explain a little more? Unfortunately I am no expert at all in nixos language. I guess the line you posted should stay inside my configuration.nix and provide network manager the right permissions.
I have a collection of connections, but if you were just doing one which is easier to get started, something like this should work (you would have to adjust it for whatever a VPN looks like):
Next thing I guess I need to do is to copy the test of the .nmconfiguration file into another file somewhere into my $HOME. But then, how to tell network manager where to look to find it?
I don’t know where NM looks for definition files other than the directory I mentioned earlier, but yes, you can also make it put the files there. Assuming those are under $HOME, you probably want to do it via home-manager instead (it’s the same principle).