Skip to content

Commit c3af2b1

Browse files
manual: Contributing -> Development, Hacking -> Compiling
what's currently called "hacking" are really instructions for setting up a development environment and compiling from source. we have a contribution guide in the repo (which rightly focuses on GitHub workflows), and the material in the manual is more about working on the code itself. since we'd otherwise have three headings that amount to "Building Nix", this change also moves the "classic Nix" instructions to the top. we may want to reorganise this in the future, and bring contributor-oriented information closer to the code, but for now let's stick to more accurate names to ease navigation.
1 parent d40e914 commit c3af2b1

File tree

4 files changed

+38
-33
lines changed

4 files changed

+38
-33
lines changed

README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ Information on additional installation methods is available on the [Nix download
2020

2121
## Building And Developing
2222

23-
See our [Hacking guide](https://nixos.org/manual/nix/unstable/contributing/hacking.html) in our manual for instruction on how to
24-
to set up a development environment and build Nix from source.
23+
Follow instructions in the Nix manual to [set up a development environment and build Nix from source](https://nixos.org/manual/nix/unstable/contributing/hacking.html).
2524

2625
## Additional Resources
2726

doc/manual/src/SUMMARY.md.in

+3-3
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@
102102
- [Serving Tarball Flakes](protocols/tarball-fetcher.md)
103103
- [Derivation "ATerm" file format](protocols/derivation-aterm.md)
104104
- [Glossary](glossary.md)
105-
- [Contributing](contributing/contributing.md)
106-
- [Hacking](contributing/hacking.md)
105+
- [Development](contributing/contributing.md)
106+
- [Building](contributing/hacking.md)
107107
- [Testing](contributing/testing.md)
108-
- [Experimental Features](contributing/experimental-features.md)
109108
- [CLI guideline](contributing/cli-guideline.md)
110109
- [C++ style guide](contributing/cxx.md)
110+
- [Experimental Features](contributing/experimental-features.md)
111111
- [Release Notes](release-notes/release-notes.md)
112112
- [Release X.Y (202?-??-??)](release-notes/rl-next.md)
113113
- [Release 2.18 (2023-09-20)](release-notes/rl-2.18.md)
+8-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
# Contributing
1+
# Development
2+
3+
Nix is developed on GitHub.
4+
Check the [contributing guide](https://github.com/NixOS/nix/blob/master/CONTRIBUTING.md) if you want to get involved.
5+
6+
This chapter is a collection of guides for making changes to the code.
7+
8+
If you're not sure where to start, try to [compile Nix from source](./hacking.md).

doc/manual/src/contributing/hacking.md

+26-27
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,33 @@
1-
# Hacking
1+
# Building Nix
22

3-
This section provides some notes on how to hack on Nix. To get the
4-
latest version of Nix from GitHub:
3+
This section provides some notes on how to start hacking on Nix.
4+
To get the latest version of Nix from GitHub:
55

66
```console
77
$ git clone https://github.com/NixOS/nix.git
88
$ cd nix
99
```
1010

11-
The following instructions assume you already have some version of Nix installed locally, so that you can use it to set up the development environment. If you don't have it installed, follow the [installation instructions].
12-
13-
[installation instructions]: ../installation/installation.md
14-
15-
## Building Nix with flakes
16-
17-
This section assumes you are using Nix with the [`flakes`] and [`nix-command`] experimental features enabled.
18-
See the [Building Nix](#building-nix) section for equivalent instructions using stable Nix interfaces.
19-
20-
[`flakes`]: @docroot@/contributing/experimental-features.md#xp-feature-flakes
21-
[`nix-command`]: @docroot@/contributing/experimental-features.md#xp-nix-command
11+
> **Note**
12+
>
13+
> The following instructions assume you already have some version of Nix installed locally, so that you can use it to set up the development environment.
14+
> If you don't have it installed, follow the [installation instructions](../installation/installation.md).
2215
2316
To build all dependencies and start a shell in which all environment variables are set up so that those dependencies can be found:
2417

2518
```console
26-
$ nix develop
19+
$ nix-shell
2720
```
2821

29-
This shell also adds `./outputs/bin/nix` to your `$PATH` so you can run `nix` immediately after building it.
30-
3122
To get a shell with one of the other [supported compilation environments](#compilation-environments):
3223

3324
```console
34-
$ nix develop .#native-clang11StdenvPackages
25+
$ nix-shell --attr devShells.x86_64-linux.native-clang11StdenvPackages
3526
```
3627

3728
> **Note**
3829
>
39-
> Use `ccacheStdenv` to drastically improve rebuild time.
30+
> You can use `native-ccacheStdenvPackages` to drastically improve rebuild time.
4031
> By default, [ccache](https://ccache.dev) keeps artifacts in `~/.cache/ccache/`.
4132
4233
To build Nix itself in this shell:
@@ -52,35 +43,43 @@ To install it in `$(pwd)/outputs` and test it:
5243
```console
5344
[nix-shell]$ make install
5445
[nix-shell]$ make installcheck -j $NIX_BUILD_CORES
55-
[nix-shell]$ nix --version
46+
[nix-shell]$ ./outputs/out/bin/nix --version
5647
nix (Nix) 2.12
5748
```
5849

5950
To build a release version of Nix for the current operating system and CPU architecture:
6051

6152
```console
62-
$ nix build
53+
$ nix-build
6354
```
6455

6556
You can also build Nix for one of the [supported platforms](#platforms).
6657

67-
## Building Nix
58+
## Building Nix with flakes
59+
60+
This section assumes you are using Nix with the [`flakes`] and [`nix-command`] experimental features enabled.
61+
See the [Building Nix](#building-nix) section for equivalent instructions using stable Nix interfaces.
62+
63+
[`flakes`]: @docroot@/contributing/experimental-features.md#xp-feature-flakes
64+
[`nix-command`]: @docroot@/contributing/experimental-features.md#xp-nix-command
6865

6966
To build all dependencies and start a shell in which all environment variables are set up so that those dependencies can be found:
7067

7168
```console
72-
$ nix-shell
69+
$ nix develop
7370
```
7471

72+
This shell also adds `./outputs/bin/nix` to your `$PATH` so you can run `nix` immediately after building it.
73+
7574
To get a shell with one of the other [supported compilation environments](#compilation-environments):
7675

7776
```console
78-
$ nix-shell --attr devShells.x86_64-linux.native-clang11StdenvPackages
77+
$ nix develop .#native-clang11StdenvPackages
7978
```
8079

8180
> **Note**
8281
>
83-
> You can use `native-ccacheStdenvPackages` to drastically improve rebuild time.
82+
> Use `ccacheStdenv` to drastically improve rebuild time.
8483
> By default, [ccache](https://ccache.dev) keeps artifacts in `~/.cache/ccache/`.
8584
8685
To build Nix itself in this shell:
@@ -96,14 +95,14 @@ To install it in `$(pwd)/outputs` and test it:
9695
```console
9796
[nix-shell]$ make install
9897
[nix-shell]$ make installcheck -j $NIX_BUILD_CORES
99-
[nix-shell]$ ./outputs/out/bin/nix --version
98+
[nix-shell]$ nix --version
10099
nix (Nix) 2.12
101100
```
102101

103102
To build a release version of Nix for the current operating system and CPU architecture:
104103

105104
```console
106-
$ nix-build
105+
$ nix build
107106
```
108107

109108
You can also build Nix for one of the [supported platforms](#platforms).

0 commit comments

Comments
 (0)