Motivation for this change
This adds a new NixOS module for configuring the default editor and
This gives every text editor in nixpkgs first-class support for being
Like with #97171, this allows for removing more things from the system
Additionally, the default editor and pager packages are now added to the
As noted in nixos/modules/programs/environment.nix:
The text was updated successfully, but these errors were encountered:
This adds a new passthru to all text editor derivations, analogous to the shellPath passthru, containing a string suitable to be used as the $EDITOR environment variable. Editors that daemonise by default are passed flags that stop them from doing so. This covers every single text editor in nixpkgs. IDEs were not given such treatment, with the rationale that they are intended to be used for editing entire projects - and often can't be configured to open single files or disable daemonisation. Similarly, task-specific text editors (such as Markdown editors) were skipped.
This introduces a new set of options for configuring the default editor and pager. users.defaults.editor can be set to any derivation with the 'editorCommand' attribute, which is a string suitable for being used as the $EDITOR variable. Similarly, the option users.defaults.pager can be set to any derivation with the 'pagerCommand' attribute, and controls the $PAGER variable. Of note: programs invoking $EDITOR and $PAGER expect the respective program to not exit until the user has finished editing/viewing the file, which means that any program that daemonises by default (such as Atom or Sublime Text) needs an additional flag to be passed. Such flags are specific to the program in question, and are usually documented in manual pages and --help output. This also means that the system path no longer implicitly contains nano and less, which is probably welcome news for anyone with particularly passionate opinions about text editors ;)
Avoiding mentioning $EDITOR anywhere other than in the documentation for users.defaults.editorCommand will help people find the option more easily, and decrease the chances of it being overlooked.