2020-07-23 00:17:48 +03:00
# Building Nix from Source
2024-08-19 17:24:38 +03:00
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.
2020-07-23 00:17:48 +03:00
2024-08-19 17:24:38 +03:00
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.
2020-07-23 00:17:48 +03:00
2024-08-19 17:24:38 +03:00
The installation path can be specified by passing the `-Dprefix=prefix`
2020-07-23 00:17:48 +03:00
to `configure` . The default installation directory is `/usr/local` . You
can change this to any location you like. You must have write permission
2020-07-23 15:28:05 +03:00
to the *prefix* path.
2020-07-23 00:17:48 +03:00
Nix keeps its *store* (the place where packages are stored) in
`/nix/store` by default. This can be changed using
2024-08-19 17:24:38 +03:00
`-Dstore-dir=path` .
2020-07-23 00:17:48 +03:00
> **Warning**
2024-08-19 17:24:38 +03:00
>
2020-07-23 00:17:48 +03:00
> 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
2024-08-19 17:24:38 +03:00
default. This can be changed using `-Dlocalstatedir=path` .