nix-super/doc/manual/src/hacking.md

72 lines
1.3 KiB
Markdown
Raw Normal View History

2020-07-23 00:17:48 +03:00
# Hacking
This section provides some notes on how to hack on Nix. To get the
latest version of Nix from GitHub:
2020-07-31 16:43:25 +03:00
```console
$ git clone https://github.com/NixOS/nix.git
$ cd nix
```
2020-07-23 00:17:48 +03:00
To build Nix for the current operating system/architecture use
2020-07-31 16:43:25 +03:00
```console
$ nix-build
```
2020-07-23 00:17:48 +03:00
or if you have a flake-enabled nix:
2020-07-23 00:17:48 +03:00
2020-07-31 16:43:25 +03:00
```console
$ nix build
```
2020-07-23 00:17:48 +03:00
This will build `defaultPackage` attribute defined in the `flake.nix`
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.
2020-07-31 16:43:25 +03:00
```console
$ nix-build -A defaultPackage.x86_64-linux
```
2020-07-23 00:17:48 +03:00
To build all dependencies and start a shell in which all environment
variables are set up so that those dependencies can be found:
2020-07-31 16:43:25 +03:00
```console
$ nix-shell
```
2020-07-23 00:17:48 +03:00
To build Nix itself in this shell:
2020-07-31 16:43:25 +03:00
```console
[nix-shell]$ ./bootstrap.sh
[nix-shell]$ ./configure $configureFlags
[nix-shell]$ make -j $NIX_BUILD_CORES
```
2020-07-23 00:17:48 +03:00
To install it in `$(pwd)/inst` and test it:
2020-07-31 16:43:25 +03:00
```console
[nix-shell]$ make install
[nix-shell]$ make installcheck
[nix-shell]$ ./inst/bin/nix --version
nix (Nix) 2.4
```
2020-07-23 00:17:48 +03:00
To run a functional test:
```console
make tests/test-name-should-auto-complete.sh.test
```
2020-07-31 16:43:25 +03:00
If you have a flakes-enabled Nix you can replace:
2020-07-23 00:17:48 +03:00
2020-07-31 16:43:25 +03:00
```console
$ nix-shell
```
2020-07-23 00:17:48 +03:00
by:
2020-07-31 16:43:25 +03:00
```console
$ nix develop
```