Home Explore Blog Models CI



nix

doc/manual/source/installation/building-source.md
2874e2045d20fa45c11241609d13337b7f0d1f255e06bc9600000003000004b0
# Building Nix from Source

Nix is built with [Meson](https://mesonbuild.com/).
It is broken up into multiple Meson packages, which are optionally combined in a single project using Meson's [subprojects](https://mesonbuild.com/Subprojects.html) feature.

There are no mandatory extra steps to the building process:
generic Meson installation instructions like [this](https://mesonbuild.com/Quick-guide.html#using-meson-as-a-distro-packager) should work.

The installation path can be specified by passing the `-Dprefix=prefix`
to `configure`. The default installation directory is `/usr/local`. You
can change this to any location you like. You must have write permission
to the *prefix* path.

Nix keeps its *store* (the place where packages are stored) in
`/nix/store` by default. This can be changed using
`-Dstore-dir=path`.

> **Warning**
>
> It is best *not* to change the Nix store from its default, since doing
> so makes it impossible to use pre-built binaries from the standard
> Nixpkgs channels — that is, all packages will need to be built from
> source.

Nix keeps state (such as its database and log files) in `/nix/var` by
default. This can be changed using `-Dlocalstatedir=path`.

Chunks
58479843 (1st chunk of `doc/manual/source/installation/building-source.md`)
Title: Building Nix from Source
Summary
This document outlines the process of building Nix from source using Meson. It notes that Nix is structured into multiple Meson packages, which can be combined using subprojects, and that standard Meson installation instructions are generally sufficient. Users can customize installation paths: `-Dprefix` for the main installation directory (default `/usr/local`), `-Dstore-dir` for the Nix store (default `/nix/store`), and `-Dlocalstatedir` for state files (default `/nix/var`). A critical warning is issued against changing the default Nix store path, as doing so will prevent the use of pre-built binaries from standard Nixpkgs channels, necessitating all packages to be built from source.