forked from lix-project/lix
Maximilian Bosch
3655875483
* By default, build artifacts should be installed into `outputs/` rather
than `inst/`[1].
* Add instructions on how to run unit-tests.
[1] 733d2e9402
1.4 KiB
1.4 KiB
Hacking
This section provides some notes on how to hack on Nix. To get the latest version of Nix from GitHub:
$ git clone https://github.com/NixOS/nix.git
$ cd nix
To build Nix for the current operating system/architecture use
$ nix-build
or if you have a flake-enabled nix:
$ nix build
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.
$ nix-build -A defaultPackage.x86_64-linux
To build all dependencies and start a shell in which all environment variables are set up so that those dependencies can be found:
$ nix-shell
To build Nix itself in this shell:
[nix-shell]$ ./bootstrap.sh
[nix-shell]$ ./configure $configureFlags --prefix=$(pwd)/outputs/out
[nix-shell]$ make -j $NIX_BUILD_CORES
To install it in $(pwd)/outputs
and test it:
[nix-shell]$ make install
[nix-shell]$ make installcheck -j $NIX_BUILD_CORES
[nix-shell]$ ./outputs/out/bin/nix --version
nix (Nix) 3.0
To run a functional test:
make tests/test-name-should-auto-complete.sh.test
To run the unit-tests for C++ code:
make check
If you have a flakes-enabled Nix you can replace:
$ nix-shell
by:
$ nix develop