Skip to content

Commit

Permalink
README: improve development docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Mic92 committed Jul 20, 2020
1 parent a79b6dd commit f0100f5
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 28 deletions.
25 changes: 3 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,16 @@ for more details.
On Linux and macOS the easiest way to Install Nix is to run the following shell command
(as a user other than root):

```
```console
$ curl -L https://nixos.org/nix/install | sh
```

Information on additional installation methods is available on the [Nix download page](https://nixos.org/download.html).

## Building And Developing

### Building Nix

You can build Nix using one of the targets provided by [release.nix](./release.nix):

```
$ nix-build ./release.nix -A build.aarch64-linux
$ nix-build ./release.nix -A build.x86_64-darwin
$ nix-build ./release.nix -A build.i686-linux
$ nix-build ./release.nix -A build.x86_64-linux
```

### Development Environment

You can use the provided `shell.nix` to get a working development environment:

```
$ nix-shell
$ ./bootstrap.sh
$ ./configure
$ make
```
See our [Hacking guide](hydra.nixos.org/job/nix/master/build.x86_64-linux/latest/download-by-type/doc/manual#chap-hacking) in our manual for instruction on how to
build nix from source with nix-build or how to get a development environment.

## Additional Resources

Expand Down
45 changes: 39 additions & 6 deletions doc/manual/hacking.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,37 @@

<title>Hacking</title>

<para>This section provides some notes on how to hack on Nix. To get
<para>This section provides some notes on how to hack on Nix. To get
the latest version of Nix from GitHub:
<screen>
$ git clone git://github.com/NixOS/nix.git
$ git clone https://github.com/NixOS/nix.git
$ cd nix
</screen>
</para>

<para>To build it and its dependencies:
<para>To build Nix for the current operating system/architecture use</para>

<screen>
$ nix-build
</screen>

or if you have a flakes-enabled nix:

<screen>
$ nix build
</screen>

This will build <literal>defaultPackage</literal> attribute defined in the <literal>flake.nix</literal> file.

To build for other platforms add one of the following suffixes to it: aarch64-linux,
i686-linux, x86_64-darwin, x86_64-linux.

i.e.

<screen>
$ nix-build release.nix -A build.x86_64-linux
nix-build -A defaultPackage.x86_64-linux
</screen>

</para>

<para>To build all dependencies and start a shell in which all
Expand All @@ -27,13 +46,27 @@ $ nix-shell
To build Nix itself in this shell:
<screen>
[nix-shell]$ ./bootstrap.sh
[nix-shell]$ configurePhase
[nix-shell]$ make
[nix-shell]$ ./configure $configureFlags
[nix-shell]$ make -j $NIX_BUILD_CORES
</screen>
To install it in <literal>$(pwd)/inst</literal> and test it:
<screen>
[nix-shell]$ make install
[nix-shell]$ make installcheck
[nix-shell]$ ./inst/bin/nix --version
nix (Nix) 2.4
</screen>

If you have a flakes-enabled nix you can replace:

<screen>
$ nix-shell
</screen>

by:

<screen>
$ nix develop
</screen>

</para>
Expand Down

0 comments on commit f0100f5

Please sign in to comment.