I’m trying to setup Emacs as my default editor also to be able to use it for quick changed in config files using sudoedit (which by default runs nano).
I’m using Flakes and Home Manager and what I currently have in my home.nix is this:
Looking at the sources, it looks like it does set an EDITOR session variable. If you cat your session vars is it present? You might need to logout/in to see the new vars.
I think you can add this line to your configuration.nix environment.variables.EDITOR = "emacs";
you’ll probably need to open a new terminal after rebuild.
Your config for emacs should work. Look at $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh
EDITOR should be something like “/nix/store/<hash>-editor”, which is a wrapper script executing emacs-client.
I booted my laptop this morning and Emacs was the default editor. Not sure what I missed. I might have got confused rebuilds and forgot to reboot at some point so didn’t see any change.