What is the propey way to use `nixvim` for `sudoedit` in other distro?

nix can be easily be installed in arch linux.
I have already set up a standalone nixvim for NixOS, I tested also install it in arch linux with nix profile install /path/to/flake and it works great.
However I do not know the proper way to make sudoedit works for that in arch linux.
My ugly solution is just symlink /usr/bin/nvim to /home/user/.nix-profile/bin/nvim, then sudoedit works, but it seems not right.

Does sudoedit use the correct editor if you do export EDITOR=/home/user/.nix-profile/bin/nvim first? If yes, you could add that export to your .bashrc.

1 Like

Yes, this is the solution. Thanks!