Skip to content

Janik-Haag/nm2nix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NetworkManager to Nix

This is a dumb script that converts every .nmconnection file in the current directory to the nix code that is expected by networking.networkmanager.ensureProfiles.profiles which was introduced in NixOS/nixpkgs/#254647 You want to pipe the output of this program through some formatter, for example nixfmt

You probably want to run this script in /etc/NetworkManager/system-connections/ (default profile storage) or /run/NetworkManager/system-connections (temporary profile storage) both folders are only readable by the root user, so you need to execute the script with root permissions aka sudo. For more details about the locations feel free to read redhat's docs

The code gets outputted as one line of nix, so you probably want to run it through a formatter like nixfmt (which the example below does).

If you just want to run the script do:

sudo su -c "cd /etc/NetworkManager/system-connections && nix --extra-experimental-features 'nix-command flakes' run github:Janik-Haag/nm2nix | nix --extra-experimental-features 'nix-command flakes' run nixpkgs#nixfmt-rfc-style"

About

Converts .nmconnection files into nix code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •