NixOS configuration editors

From NixOS Wiki
Revision as of 12:40, 31 August 2022 by imported>Milahu (add link: Configuration Collection)

Creating graphical editors for NixOS configurations is hard because of the amount and complexity of options and the resulting possibilities.

Text editors

To improve the editing experience of configuration.nix, it is recommend to use a text editor with syntax highlighting and language server (autocompletion, formatting, refactoring).

See also: Editor Modes for Nix Files

Editing as normal user

The configuration files in /etc/nixos/ are owned by root, so for every "save" operation, the editor will ask for the sudo password. To avoid this, we can move the config files to a user's home folder:

mkdir ~/etc
sudo mv /etc/nixos ~/etc/
sudo chown -R $(id -un):users ~/etc/nixos
sudo ln -s ~/etc/nixos /etc/

Now you can run codium /etc/nixos to edit the config with VSCodium, and sudo nixos-rebuild switch to build the config.

It's also a good idea to track the config files with git, and to make backups.

Graphical editors

It is also possible to use a graphical config manager, which can't express all features of NixOS, but is simple to use.

nix-gui by lapp0

nixos-manager by pmiddend

nixos-conf-editor by vlinkz

nixui by matejc

Nixos-Gui by Celestialme

See also