aboutsummaryrefslogtreecommitdiff
path: root/src/nix/edit.md
blob: 80563d06b3a08cac0777d0a2f6cd0ae372b97460 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
R""(

# Examples

* Open the Nix expression of the GNU Hello package:

  ```console
  # nix edit nixpkgs#hello
  ```

* Get the filename and line number used by `nix edit`:

  ```console
  # 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` or
`vim`, it is passed the line number of the derivation using the
argument `+<lineno>`.

)""