Skip to content

Commit 3f96c18

Browse files
docs: add instructions to load development utilities
Co-authored-by: Valentin Gagarin <[email protected]>
1 parent efbf556 commit 3f96c18

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
lines changed

doc/README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,27 @@ $ nix-build doc
3434

3535
If the build succeeds, the manual will be in `./result/share/doc/nixpkgs/manual.html`.
3636

37-
### devmode
37+
### Development environment
38+
39+
In order to reduce repetition, consider using tools from the provided development environment:
40+
41+
Load it from the Nixpkgs documentation directory with
42+
43+
```ShellSession
44+
$ cd /path/to/nixpkgs/doc
45+
$ nix-shell
46+
```
47+
48+
To load the development utilities automatically when entering that directory, [set up `nix-direnv`](https://nix.dev/guides/recipes/direnv).
49+
50+
Make sure that your local files aren't added to Git history by adding the following lines to `.git/info/exclude` at the root of the Nixpkgs repository:
51+
52+
```
53+
/**/.envrc
54+
/**/.direnv
55+
```
56+
57+
#### `devmode`
3858

3959
The shell in the manual source directory makes available a command, `devmode`.
4060
It is a daemon, that:

nixos/doc/manual/contributing-to-this-manual.chapter.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,28 @@ There's also [a convenient development daemon](https://nixos.org/manual/nixpkgs/
1717

1818
The above instructions don't deal with the appendix of available `configuration.nix` options, and the manual pages related to NixOS. These are built, and written in a different location and in a different format, as explained in the next sections.
1919

20+
## Development environment {#sec-contributing-development-env}
21+
22+
In order to reduce repetition, consider using tools from the provided development environment:
23+
24+
Load it from the NixOS documentation directory with
25+
26+
```ShellSession
27+
$ cd /path/to/nixpkgs/nixos/doc/manual
28+
$ nix-shell
29+
```
30+
31+
To load the development utilities automatically when entering that directory, [set up `nix-direnv`](https://nix.dev/guides/recipes/direnv).
32+
33+
Make sure that your local files aren't added to Git history by adding the following lines to `.git/info/exclude` at the root of the Nixpkgs repository:
34+
35+
```
36+
/**/.envrc
37+
/**/.direnv
38+
```
39+
40+
You might want to also use [`devmode`](https://github.com/NixOS/nixpkgs/blob/master/doc/README.md#devmode) while editing the manual.
41+
2042
## Testing redirects {#sec-contributing-redirects}
2143

2244
Once you have a successful build, you can open the relevant HTML (path mentioned above) in a browser along with the anchor, and observe the redirection.

nixos/doc/manual/redirects.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@
7171
"ch-installation": [
7272
"index.html#ch-installation"
7373
],
74+
"sec-contributing-development-env": [
75+
"index.html#sec-contributing-development-env"
76+
],
7477
"sec-mattermost": [
7578
"index.html#sec-mattermost"
7679
],

0 commit comments

Comments
 (0)