aboutsummaryrefslogtreecommitdiff
path: root/src/nix/edit.md
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-12-23 21:10:32 +0100
committerGitHub <noreply@github.com>2020-12-23 21:10:32 +0100
commita93916b1905cd7b968e92cd94a3e4a595bff2e0f (patch)
tree178e04a23a35b9a4ede224bdcb903e75c188a304 /src/nix/edit.md
parent8927cba62f5afb33b01016d5c4f7f8b7d0adde3c (diff)
parent5178211e963fa111f84c4881b22cc506d5254fde (diff)
Merge pull request #4336 from NixOS/manpages
Documentation for nix subcommands
Diffstat (limited to 'src/nix/edit.md')
-rw-r--r--src/nix/edit.md31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/nix/edit.md b/src/nix/edit.md
new file mode 100644
index 000000000..80563d06b
--- /dev/null
+++ b/src/nix/edit.md
@@ -0,0 +1,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>`.
+
+)""