fresh/clean install. edi the config file to add a package (in this case an editor) - but no editor is easy to find in the initial config to edit later the config (this is called the chicken and egg problem?)
by the way - the manual, when mentioning the config file, point out its full name (including the location in /etc/nixos). this is not obvious when you run nix the first time!
(This happens with all reasonable NixOS versions — @7c6f434c )
There is an editor, nano
.
Technically, you can nix-env -iA vim
or something without editing config, then, if desired, remove the editor from profile when it is installed system-wide.
thank you - i did not think of nano. i was looking through the menus and did not find any; of course, nano would not be listed there. perhaps you add a comment to avoid stupid questions like this from newbies trying to use your interesting OS.
Let's hijack the issue to describe the real problem then…
While we are on it we could also think about adding an option in nix that installs your chosen default editor and sets the EDITOR
env accordingly.
good idea! for newbies, give some hints (e.g. gedit or similar)
Perhaps add environment.variables."EDITOR" = "${pkgs.nano}/bin/nano";
to the template?
But I saw that we also have programs.vim.defaultEditor
and services.emacs.defaultEditor
.
I suggest we deprecate programs.vim.defaultEditor
and services.emacs.defaultEditor
and wrap the environment variable to something nice like programs.editor.default = nano|emacs|vim
like it has been done withservices.xserver.windowManager.default
.
add one of the simple editors as well - gedit, mousepad or one of the other graphical easy ones. It is important to have a very low entry threshold to capture new potential users. Something like the 2 second rules on web pages: if the new OS does not work out of the box for the newbie, it is dumped...
I'm all for making editing text files easy, but I'm not sure what good it is to set EDITOR to something with a gui. I think a user that might need help with editing text files will install a desktop environment that presents it's default editor to the user by itself. On the other hand, a user might try to do something like
sudo $EDITOR /etc/nixos/configuration.nix
because they pasted it from some web page and unknowingly run gedit with root, making their system insecure.
What makes it more insecure and using an terminal-based one with root privileges?
$EDITOR
is expected to point to an editor that works without X, whether run as root or not. sudoedit
uses $EDITOR
and is expected to also work in the system terminals, independent of whether any X session is present.
I'm all for setting EDITOR to something sane like nano
by default and
for generalizing it similarly to X11.
add one of the simple editors as well - gedit, mousepad or one of the other graphical easy ones. It is important to have a very low entry threshold to capture new potential users. Something like the 2 second rules on web pages: if the new OS does not work out of the box for the newbie, it is dumped...
I don't think this argument really applies to NixOS. Any OS that
_requires_ you to edit some configuration files before you even install
it is not for a newbie unless that newbie has some interested IT
personnel around.
I imagine it could be possible to make a usable GUI for
configuration.nix
with text lenses (in Haskell), though.
But, in general, good installers (like Debian's) take a lot of effort to
produce and yet most people never ever install their OS and most people
that do install their OS could have just learned the shell commands.
Thank you for your contributions.
This has been automatically marked as stale because it has had no activity for 180 days.
If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.
Here are suggestions that might help resolve this more quickly:
I think we should include nano in our configuration.nix
that we generate.
I think we should include nano in our
configuration.nix
that we generate.
Would
https://github.com/NixOS/nixpkgs/blob/c9057b3751a604ba009a85acc45dde06c919886e/nixos/modules/installer/tools/tools.nix#L125-L127
be the right place to change that?
Most helpful comment
I suggest we deprecate
programs.vim.defaultEditor
andservices.emacs.defaultEditor
and wrap the environment variable to something nice likeprograms.editor.default = nano|emacs|vim
like it has been done withservices.xserver.windowManager.default
.