lix/src/nix/edit.md
Qyriad 194ba8a02f docs: guide to installables docs in installable commands' docs
The installables syntax is not documented in any of the man pages or
docbook pages for any of those individual commands. And while these
commands really should at least peripherally individually document how
installables work, in the meantime we can at least direct people to the
right place.

This commit also clarifies the unexpected fact that `nix profile remove`
and `nix profile upgrade` do *not* take installables.

Change-Id: I3b1453cb197a613bbab639c66a466365c3592c6d
2024-04-29 08:06:05 -06:00

1 KiB

R""(

Note: this command's interface is based heavily around installables, which you may want to read about first (nix --help).

Examples

  • Open the Nix expression of the GNU Hello package:

    # nix edit nixpkgs#hello
    
  • Get the filename and line number used by nix edit:

    # nix eval --raw nixpkgs#hello.meta.position
    /nix/store/fvafw0gvwayzdan642wrv84pzm5bgpmy-source/pkgs/applications/misc/hello/default.nix:15
    

Description

This command opens the Nix expression of a derivation in an editor. The filename and line number of the derivation are taken from its meta.position attribute. Nixpkgs' stdenv.mkDerivation sets this attribute to the location of the definition of the meta.description, version or name derivation attributes.

The editor to invoke is specified by the EDITOR environment variable. It defaults to cat. If the editor is emacs, nano, vim or kak, it is passed the line number of the derivation using the argument +<lineno>.

)""