mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-30 09:36:15 +02:00
Add 'nix edit' manpage
This commit is contained in:
parent
4e065229c7
commit
b2262be19b
2 changed files with 35 additions and 7 deletions
|
@ -15,14 +15,11 @@ struct CmdEdit : InstallableCommand
|
||||||
return "open the Nix expression of a Nix package in $EDITOR";
|
return "open the Nix expression of a Nix package in $EDITOR";
|
||||||
}
|
}
|
||||||
|
|
||||||
Examples examples() override
|
std::string doc() override
|
||||||
{
|
{
|
||||||
return {
|
return
|
||||||
Example{
|
#include "edit.md"
|
||||||
"To open the Nix expression of the GNU Hello package:",
|
;
|
||||||
"nix edit nixpkgs#hello"
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Category category() override { return catSecondary; }
|
Category category() override { return catSecondary; }
|
||||||
|
|
31
src/nix/edit.md
Normal file
31
src/nix/edit.md
Normal file
|
@ -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>`.
|
||||||
|
|
||||||
|
)""
|
Loading…
Reference in a new issue