NixOS configuration editors: Difference between revisions

From NixOS Wiki
imported>Milahu
Created page with "Creating graphical editors for NixOS configuration is hard, because the Nix language is complex. So, either you get a Nix text editor with a language server (autocomplete and..."
 
Klinger (talk | contribs)
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Creating graphical editors for NixOS configuration is hard, because the Nix language is complex.
Creating graphical editors for NixOS configurations is hard because of the amount and complexity of options and the resulting possibilities.


So, either you get a Nix text editor with a language server (autocomplete and suggestions, based on the NixOS config schema),
== Text editors ==
or you get a graphical config manager, which cannot express all features of Nix.


== Implementations ==
To improve the editing experience of <code>configuration.nix</code>, 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 <code>/etc/nixos/</code> 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:
 
<pre>
mkdir ~/etc
sudo mv /etc/nixos ~/etc/
sudo chown -R $(id -un):users ~/etc/nixos
sudo ln -s ~/etc/nixos /etc/
</pre>
 
Now you can run <code>codium /etc/nixos</code> to edit the config with VSCodium, and <code>sudo nixos-rebuild switch</code> to build the config.
 
It's also a good idea to track the config files with <code>git</code>, 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 ===
=== nix-gui by lapp0 ===
Line 10: Line 30:
* https://github.com/nix-gui/nix-gui
* https://github.com/nix-gui/nix-gui
* https://discourse.nixos.org/t/nix-gui-use-nixos-without-coding/15409
* https://discourse.nixos.org/t/nix-gui-use-nixos-without-coding/15409
* python + qt5 desktop app
* python + qt5 desktop program
* 520 github stars
* 580+ GitHub stars


=== nixos-manager by pmiddend ===
=== nixos-manager by pmiddend ===
Line 17: Line 37:
* https://github.com/pmiddend/nixos-manager
* https://github.com/pmiddend/nixos-manager
* https://discourse.nixos.org/t/nixos-manager-manage-your-nixos-configuration-graphically/6685
* https://discourse.nixos.org/t/nixos-manager-manage-your-nixos-configuration-graphically/6685
* haskell + gtk desktop app
* haskell + gtk desktop program
* 150 github stars
* 160+ GitHub stars
* last commit: 2020


=== nixos-conf-editor by vlinkz ===
=== nixos-conf-editor by vlinkz ===
Line 25: Line 46:
* https://discourse.nixos.org/t/nixos-conf-editor-a-gtk4-libadwaita-configuration-editor/19426
* https://discourse.nixos.org/t/nixos-conf-editor-a-gtk4-libadwaita-configuration-editor/19426
* https://www.reddit.com/r/NixOS/comments/w1pwmd/nixos_configuration_editor_a_gtk4libadwaita_app/
* https://www.reddit.com/r/NixOS/comments/w1pwmd/nixos_configuration_editor_a_gtk4libadwaita_app/
* rust + gtk4 desktop app
* rust + gtk4 desktop program
* 50 github stars
* 210+ GitHub stars
* backend tool: https://github.com/vlinkz/nix-editor - 50+ GitHub stars
* package manager: https://github.com/vlinkz/nix-software-center - 250+ GitHub stars


backend tool: https://github.com/vlinkz/nix-editor
=== nixui by matejc ===
 
* https://github.com/matejc/nixui
* https://blog.matejc.com/blogs/myblog/graphical-ui-for-nix
* 40+ GitHub stars
* last commit: 2015


=== Nixos-Gui by Celestialme ===
=== Nixos-Gui by Celestialme ===
Line 34: Line 62:
* https://github.com/Celestialme/Nixos-Gui
* https://github.com/Celestialme/Nixos-Gui
* https://www.reddit.com/r/NixOS/comments/vfywyv/nix_gui_application_to_manage_nixos_build_with/
* https://www.reddit.com/r/NixOS/comments/vfywyv/nix_gui_application_to_manage_nixos_build_with/
* svelte + tauri desktop app
* svelte + tauri desktop program
* 15 github stars
* 20+ GitHub stars
 
== Web-based editors ==
 
=== mynixos.com ===
 
https://mynixos.com/
 
"create and share software configurations using the NixOS ecosystem"


== See also ==
== See also ==


* [[Configuration Collection]]
* https://www.reddit.com/r/NixOS/comments/cu4dle/should_nix_have_a_gui/
* https://www.reddit.com/r/NixOS/comments/cu4dle/should_nix_have_a_gui/
* https://discourse.nixos.org/t/how-would-your-nixos-configuration-tool-look/1380
* https://www.reddit.com/r/nosyntax - structural editors
* https://www.reddit.com/r/nosyntax - structural editors
* [[Editor Modes for Nix Files]]
* [[Nixos-rebuild#Specifying a different configuration location]]
* https://discourse.nixos.org/t/use-vscode-editor-configuration-nix-cant-save/14119
[[Category:Applications]]

Latest revision as of 20:16, 24 April 2024

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

Web-based editors

mynixos.com

https://mynixos.com/

"create and share software configurations using the NixOS ecosystem"

See also