Open awall opened 1 year ago
This isn't an issue with nix, but rather nixpkgs where the relevant nixos code is stored (the distinctions can be confusing). You should file the issue in https://github.com/NixOS/nixpkgs
@fricklerhandwerk can you please move this?
This is working as expected, see https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh#L418
The EDITOR
variable is not set, you probably want to run sudo -E
or chmod/chown your config so that it can be edited by your normal user.
@SuperSandro2000 Thanks for the insight. I set EDITOR
to nvim
using environment.variables.EDITOR = "nvim";
, but this doesn't appear to change the root user's variable. I wrote a script with echo "$EDITOR"
, and running with sudo
prints ""
, while running with my user prints "nvim"
.
Am I just misunderstanding how environment.variables
works? Is it not meant to touch the root's environment?
For me there is also a difference if I run an interactive shell (EDITOR is set to nvim) or not (editor is set to vim). Not sure why though.
https://nixos.wiki/wiki/NixOS_configuration_editors
I guess this helps you edit /etc/nixos/configuration.nix
in editor of your choice.
worked for me.
Please use links to the new wiki https://wiki.nixos.org/wiki/NixOS_configuration_editors
https://nixos.wiki/wiki/NixOS_configuration_editors
I guess this helps you edit
/etc/nixos/configuration.nix
in editor of your choice. worked for me.
Just to point it out for other future readers: this is not a solution, the issue is related to how to change the default editor when you use sudo nixos-rebuild edit
, not how to use an alternative one.
Describe the bug When running
nixos-rebuild edit
as root, the default editor is ignored. It always uses nano, no matter how anything is configured.👟 Reproduction steps
programs.neovim.enable = true;
andprograms.neovim.defaultEditor = true;
to/etc/nixos/configuration.nix
.sudo nixos-rebuild switch
.sudo nixos-rebuild edit
.👀 Expected behavior
sudo nixos-rebuild edit
should open/etc/nixos/configuration.nix
in neovim.😓 Actual Behavior
sudo nixos-rebuild edit
opensconfiguration.nix
in nano, regardless of my configuration.Priorities
Add :+1: to issues you find important.