mirror of
https://github.com/NixOS/nix
synced 2025-07-08 02:43:54 +02:00
Rename doc/manual{src -> source}
This is needed to avoid this https://github.com/mesonbuild/meson/issues/13774 when we go back to making our subproject directory `src`.
This commit is contained in:
parent
d5c45952ac
commit
eb7d7780b1
221 changed files with 75 additions and 74 deletions
26
doc/manual/source/installation/building-source.md
Normal file
26
doc/manual/source/installation/building-source.md
Normal file
|
@ -0,0 +1,26 @@
|
|||
# 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`.
|
62
doc/manual/source/installation/env-variables.md
Normal file
62
doc/manual/source/installation/env-variables.md
Normal file
|
@ -0,0 +1,62 @@
|
|||
# Environment Variables
|
||||
|
||||
To use Nix, some environment variables should be set. In particular,
|
||||
`PATH` should contain the directories `prefix/bin` and
|
||||
`~/.nix-profile/bin`. The first directory contains the Nix tools
|
||||
themselves, while `~/.nix-profile` is a symbolic link to the current
|
||||
*user environment* (an automatically generated package consisting of
|
||||
symlinks to installed packages). The simplest way to set the required
|
||||
environment variables is to include the file
|
||||
`prefix/etc/profile.d/nix.sh` in your `~/.profile` (or similar), like
|
||||
this:
|
||||
|
||||
```bash
|
||||
source prefix/etc/profile.d/nix.sh
|
||||
```
|
||||
|
||||
# `NIX_SSL_CERT_FILE`
|
||||
|
||||
If you need to specify a custom certificate bundle to account for an
|
||||
HTTPS-intercepting man in the middle proxy, you must specify the path to
|
||||
the certificate bundle in the environment variable `NIX_SSL_CERT_FILE`.
|
||||
|
||||
If you don't specify a `NIX_SSL_CERT_FILE` manually, Nix will install
|
||||
and use its own certificate bundle.
|
||||
|
||||
Set the environment variable and install Nix
|
||||
|
||||
```console
|
||||
$ export NIX_SSL_CERT_FILE=/etc/ssl/my-certificate-bundle.crt
|
||||
$ curl -L https://nixos.org/nix/install | sh
|
||||
```
|
||||
|
||||
In the shell profile and rc files (for example, `/etc/bashrc`,
|
||||
`/etc/zshrc`), add the following line:
|
||||
|
||||
```bash
|
||||
export NIX_SSL_CERT_FILE=/etc/ssl/my-certificate-bundle.crt
|
||||
```
|
||||
|
||||
> **Note**
|
||||
>
|
||||
> You must not add the export and then do the install, as the Nix
|
||||
> installer will detect the presence of Nix configuration, and abort.
|
||||
|
||||
If you use the Nix daemon, you should also add the following to
|
||||
`/etc/nix/nix.conf`:
|
||||
|
||||
```
|
||||
ssl-cert-file = /etc/ssl/my-certificate-bundle.crt
|
||||
```
|
||||
|
||||
## Proxy Environment Variables
|
||||
|
||||
The Nix installer has special handling for these proxy-related
|
||||
environment variables: `http_proxy`, `https_proxy`, `ftp_proxy`,
|
||||
`all_proxy`, `no_proxy`, `HTTP_PROXY`, `HTTPS_PROXY`, `FTP_PROXY`,
|
||||
`ALL_PROXY`, `NO_PROXY`.
|
||||
|
||||
If any of these variables are set when running the Nix installer, then
|
||||
the installer will create an override file at
|
||||
`/etc/systemd/system/nix-daemon.service.d/override.conf` so `nix-daemon`
|
||||
will use them.
|
46
doc/manual/source/installation/index.md
Normal file
46
doc/manual/source/installation/index.md
Normal file
|
@ -0,0 +1,46 @@
|
|||
# Installation
|
||||
|
||||
This section describes how to install and configure Nix for first-time use.
|
||||
|
||||
The current recommended option on Linux and MacOS is [multi-user](#multi-user).
|
||||
|
||||
## Multi-user
|
||||
|
||||
This installation offers better sharing, improved isolation, and more security
|
||||
over a single user installation.
|
||||
|
||||
This option requires either:
|
||||
|
||||
* Linux running systemd, with SELinux disabled
|
||||
* MacOS
|
||||
|
||||
> **Updating to macOS 15 Sequoia**
|
||||
>
|
||||
> If you recently updated to macOS 15 Sequoia and are getting
|
||||
> ```console
|
||||
> error: the user '_nixbld1' in the group 'nixbld' does not exist
|
||||
> ```
|
||||
> when running Nix commands, refer to GitHub issue [NixOS/nix#10892](https://github.com/NixOS/nix/issues/10892) for instructions to fix your installation without reinstalling.
|
||||
|
||||
```console
|
||||
$ curl -L https://nixos.org/nix/install | sh -s -- --daemon
|
||||
```
|
||||
|
||||
## Single-user
|
||||
|
||||
> Single-user is not supported on Mac.
|
||||
|
||||
This installation has less requirements than the multi-user install, however it
|
||||
cannot offer equivalent sharing, isolation, or security.
|
||||
|
||||
This option is suitable for systems without systemd.
|
||||
|
||||
```console
|
||||
$ curl -L https://nixos.org/nix/install | sh -s -- --no-daemon
|
||||
```
|
||||
|
||||
## Distributions
|
||||
|
||||
The Nix community maintains installers for several distributions.
|
||||
|
||||
They can be found in the [`nix-community/nix-installers`](https://github.com/nix-community/nix-installers) repository.
|
158
doc/manual/source/installation/installing-binary.md
Normal file
158
doc/manual/source/installation/installing-binary.md
Normal file
|
@ -0,0 +1,158 @@
|
|||
# Installing a Binary Distribution
|
||||
|
||||
> **Updating to macOS 15 Sequoia**
|
||||
>
|
||||
> If you recently updated to macOS 15 Sequoia and are getting
|
||||
> ```console
|
||||
> error: the user '_nixbld1' in the group 'nixbld' does not exist
|
||||
> ```
|
||||
> when running Nix commands, refer to GitHub issue [NixOS/nix#10892](https://github.com/NixOS/nix/issues/10892) for instructions to fix your installation without reinstalling.
|
||||
|
||||
To install the latest version Nix, run the following command:
|
||||
|
||||
```console
|
||||
$ curl -L https://nixos.org/nix/install | sh
|
||||
```
|
||||
|
||||
This performs the default type of installation for your platform:
|
||||
|
||||
- [Multi-user](#multi-user-installation):
|
||||
- Linux with systemd and without SELinux
|
||||
- macOS
|
||||
- [Single-user](#single-user-installation):
|
||||
- Linux without systemd
|
||||
- Linux with SELinux
|
||||
|
||||
We recommend the multi-user installation if it supports your platform and you can authenticate with `sudo`.
|
||||
|
||||
The installer can configured with various command line arguments and environment variables.
|
||||
To show available command line flags:
|
||||
|
||||
```console
|
||||
$ curl -L https://nixos.org/nix/install | sh -s -- --help
|
||||
```
|
||||
|
||||
To check what it does and how it can be customised further, [download and edit the second-stage installation script](#installing-from-a-binary-tarball).
|
||||
|
||||
# Installing a pinned Nix version from a URL
|
||||
|
||||
Version-specific installation URLs for all Nix versions since 1.11.16 can be found at [releases.nixos.org](https://releases.nixos.org/?prefix=nix/).
|
||||
The directory for each version contains the corresponding SHA-256 hash.
|
||||
|
||||
All installation scripts are invoked the same way:
|
||||
|
||||
```console
|
||||
$ export VERSION=2.19.2
|
||||
$ curl -L https://releases.nixos.org/nix/nix-$VERSION/install | sh
|
||||
```
|
||||
|
||||
# Multi User Installation
|
||||
|
||||
The multi-user Nix installation creates system users and a system service for the Nix daemon.
|
||||
|
||||
Supported systems:
|
||||
|
||||
- Linux running systemd, with SELinux disabled
|
||||
- macOS
|
||||
|
||||
To explicitly instruct the installer to perform a multi-user installation on your system:
|
||||
|
||||
```console
|
||||
$ bash <(curl -L https://nixos.org/nix/install) --daemon
|
||||
```
|
||||
|
||||
You can run this under your usual user account or `root`.
|
||||
The script will invoke `sudo` as needed.
|
||||
|
||||
# Single User Installation
|
||||
|
||||
To explicitly select a single-user installation on your system:
|
||||
|
||||
```console
|
||||
$ bash <(curl -L https://nixos.org/nix/install) --no-daemon
|
||||
```
|
||||
|
||||
In a single-user installation, `/nix` is owned by the invoking user.
|
||||
The script will invoke `sudo` to create `/nix` if it doesn’t already exist.
|
||||
If you don’t have `sudo`, manually create `/nix` as `root`:
|
||||
|
||||
```console
|
||||
$ su root
|
||||
# mkdir /nix
|
||||
# chown alice /nix
|
||||
```
|
||||
|
||||
# Installing from a binary tarball
|
||||
|
||||
You can also download a binary tarball that contains Nix and all its dependencies:
|
||||
- Choose a [version](https://releases.nixos.org/?prefix=nix/) and [system type](../development/building.md#platforms)
|
||||
- Download and unpack the tarball
|
||||
- Run the installer
|
||||
|
||||
> **Example**
|
||||
>
|
||||
> ```console
|
||||
> $ pushd $(mktemp -d)
|
||||
> $ export VERSION=2.19.2
|
||||
> $ export SYSTEM=x86_64-linux
|
||||
> $ curl -LO https://releases.nixos.org/nix/nix-$VERSION/nix-$VERSION-$SYSTEM.tar.xz
|
||||
> $ tar xfj nix-$VERSION-$SYSTEM.tar.xz
|
||||
> $ cd nix-$VERSION-$SYSTEM
|
||||
> $ ./install
|
||||
> $ popd
|
||||
> ```
|
||||
|
||||
The installer can be customised with the environment variables declared in the file named `install-multi-user`.
|
||||
|
||||
## Native packages for Linux distributions
|
||||
|
||||
The Nix community maintains installers for some Linux distributions in their native packaging format(https://nix-community.github.io/nix-installers/).
|
||||
|
||||
# macOS Installation
|
||||
|
||||
<!-- anchors to catch existing links -->
|
||||
[]{#sect-macos-installation-change-store-prefix}[]{#sect-macos-installation-encrypted-volume}[]{#sect-macos-installation-symlink}[]{#sect-macos-installation-recommended-notes}
|
||||
|
||||
We believe we have ironed out how to cleanly support the read-only root file system
|
||||
on modern macOS. New installs will do this automatically.
|
||||
|
||||
This section previously detailed the situation, options, and trade-offs,
|
||||
but it now only outlines what the installer does. You don't need to know
|
||||
this to run the installer, but it may help if you run into trouble:
|
||||
|
||||
- create a new APFS volume for your Nix store
|
||||
- update `/etc/synthetic.conf` to direct macOS to create a "synthetic"
|
||||
empty root directory to mount your volume
|
||||
- specify mount options for the volume in `/etc/fstab`
|
||||
- `rw`: read-write
|
||||
- `noauto`: prevent the system from auto-mounting the volume (so the
|
||||
LaunchDaemon mentioned below can control mounting it, and to avoid
|
||||
masking problems with that mounting service).
|
||||
- `nobrowse`: prevent the Nix Store volume from showing up on your
|
||||
desktop; also keeps Spotlight from spending resources to index
|
||||
this volume
|
||||
<!-- TODO:
|
||||
- `suid`: honor setuid? surely not? ...
|
||||
- `owners`: honor file ownership on the volume
|
||||
|
||||
For now I'll avoid pretending to understand suid/owners more
|
||||
than I do. There've been some vague reports of file-ownership
|
||||
and permission issues, particularly in cloud/VM/headless setups.
|
||||
My pet theory is that this has something to do with these setups
|
||||
not having a token that gets delegated to initial/admin accounts
|
||||
on macOS. See scripts/create-darwin-volume.sh for a little more.
|
||||
|
||||
In any case, by Dec 4 2021, it _seems_ like some combination of
|
||||
suid, owners, and calling diskutil enableOwnership have stopped
|
||||
new reports from coming in. But I hesitate to celebrate because we
|
||||
haven't really named and catalogued the behavior, understood what
|
||||
we're fixing, and validated that all 3 components are essential.
|
||||
-->
|
||||
- if you have FileVault enabled
|
||||
- generate an encryption password
|
||||
- put it in your system Keychain
|
||||
- use it to encrypt the volume
|
||||
- create a system LaunchDaemon to mount this volume early enough in the
|
||||
boot process to avoid problems loading or restoring any programs that
|
||||
need access to your Nix store
|
||||
|
59
doc/manual/source/installation/installing-docker.md
Normal file
59
doc/manual/source/installation/installing-docker.md
Normal file
|
@ -0,0 +1,59 @@
|
|||
# Using Nix within Docker
|
||||
|
||||
To run the latest stable release of Nix with Docker run the following command:
|
||||
|
||||
```console
|
||||
$ docker run -ti ghcr.io/nixos/nix
|
||||
Unable to find image 'ghcr.io/nixos/nix:latest' locally
|
||||
latest: Pulling from ghcr.io/nixos/nix
|
||||
5843afab3874: Pull complete
|
||||
b52bf13f109c: Pull complete
|
||||
1e2415612aa3: Pull complete
|
||||
Digest: sha256:27f6e7f60227e959ee7ece361f75d4844a40e1cc6878b6868fe30140420031ff
|
||||
Status: Downloaded newer image for ghcr.io/nixos/nix:latest
|
||||
35ca4ada6e96:/# nix --version
|
||||
nix (Nix) 2.3.12
|
||||
35ca4ada6e96:/# exit
|
||||
```
|
||||
|
||||
# What is included in Nix's Docker image?
|
||||
|
||||
The official Docker image is created using `pkgs.dockerTools.buildLayeredImage`
|
||||
(and not with `Dockerfile` as it is usual with Docker images). You can still
|
||||
base your custom Docker image on it as you would do with any other Docker
|
||||
image.
|
||||
|
||||
The Docker image is also not based on any other image and includes minimal set
|
||||
of runtime dependencies that are required to use Nix:
|
||||
|
||||
- pkgs.nix
|
||||
- pkgs.bashInteractive
|
||||
- pkgs.coreutils-full
|
||||
- pkgs.gnutar
|
||||
- pkgs.gzip
|
||||
- pkgs.gnugrep
|
||||
- pkgs.which
|
||||
- pkgs.curl
|
||||
- pkgs.less
|
||||
- pkgs.wget
|
||||
- pkgs.man
|
||||
- pkgs.cacert.out
|
||||
- pkgs.findutils
|
||||
|
||||
# Docker image with the latest development version of Nix
|
||||
|
||||
To get the latest image that was built by [Hydra](https://hydra.nixos.org) run
|
||||
the following command:
|
||||
|
||||
```console
|
||||
$ curl -L https://hydra.nixos.org/job/nix/master/dockerImage.x86_64-linux/latest/download/1 | docker load
|
||||
$ docker run -ti nix:2.5pre20211105
|
||||
```
|
||||
|
||||
You can also build a Docker image from source yourself:
|
||||
|
||||
```console
|
||||
$ nix build ./\#hydraJobs.dockerImage.x86_64-linux
|
||||
$ docker load -i ./result/image.tar.gz
|
||||
$ docker run -ti nix:2.5pre20211105
|
||||
```
|
4
doc/manual/source/installation/installing-source.md
Normal file
4
doc/manual/source/installation/installing-source.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
# Installing Nix from Source
|
||||
|
||||
If no binary package is available or if you want to hack on Nix, you
|
||||
can build Nix from its Git repository.
|
77
doc/manual/source/installation/multi-user.md
Normal file
77
doc/manual/source/installation/multi-user.md
Normal file
|
@ -0,0 +1,77 @@
|
|||
# Multi-User Mode
|
||||
|
||||
To allow a Nix store to be shared safely among multiple users, it is
|
||||
important that users are not able to run builders that modify the Nix
|
||||
store or database in arbitrary ways, or that interfere with builds
|
||||
started by other users. If they could do so, they could install a Trojan
|
||||
horse in some package and compromise the accounts of other users.
|
||||
|
||||
To prevent this, the Nix store and database are owned by some privileged
|
||||
user (usually `root`) and builders are executed under special user
|
||||
accounts (usually named `nixbld1`, `nixbld2`, etc.). When a unprivileged
|
||||
user runs a Nix command, actions that operate on the Nix store (such as
|
||||
builds) are forwarded to a *Nix daemon* running under the owner of the
|
||||
Nix store/database that performs the operation.
|
||||
|
||||
> **Note**
|
||||
>
|
||||
> Multi-user mode has one important limitation: only root and a set of
|
||||
> trusted users specified in `nix.conf` can specify arbitrary binary
|
||||
> caches. So while unprivileged users may install packages from
|
||||
> arbitrary Nix expressions, they may not get pre-built binaries.
|
||||
|
||||
## Setting up the build users
|
||||
|
||||
The *build users* are the special UIDs under which builds are performed.
|
||||
They should all be members of the *build users group* `nixbld`. This
|
||||
group should have no other members. The build users should not be
|
||||
members of any other group. On Linux, you can create the group and users
|
||||
as follows:
|
||||
|
||||
```console
|
||||
$ groupadd -r nixbld
|
||||
$ for n in $(seq 1 10); do useradd -c "Nix build user $n" \
|
||||
-d /var/empty -g nixbld -G nixbld -M -N -r -s "$(which nologin)" \
|
||||
nixbld$n; done
|
||||
```
|
||||
|
||||
This creates 10 build users. There can never be more concurrent builds
|
||||
than the number of build users, so you may want to increase this if you
|
||||
expect to do many builds at the same time.
|
||||
|
||||
## Running the daemon
|
||||
|
||||
The [Nix daemon](../command-ref/nix-daemon.md) should be started as
|
||||
follows (as `root`):
|
||||
|
||||
```console
|
||||
$ nix-daemon
|
||||
```
|
||||
|
||||
You’ll want to put that line somewhere in your system’s boot scripts.
|
||||
|
||||
To let unprivileged users use the daemon, they should set the
|
||||
[`NIX_REMOTE` environment variable](../command-ref/env-common.md) to
|
||||
`daemon`. So you should put a line like
|
||||
|
||||
```console
|
||||
export NIX_REMOTE=daemon
|
||||
```
|
||||
|
||||
into the users’ login scripts.
|
||||
|
||||
## Restricting access
|
||||
|
||||
To limit which users can perform Nix operations, you can use the
|
||||
permissions on the directory `/nix/var/nix/daemon-socket`. For instance,
|
||||
if you want to restrict the use of Nix to the members of a group called
|
||||
`nix-users`, do
|
||||
|
||||
```console
|
||||
$ chgrp nix-users /nix/var/nix/daemon-socket
|
||||
$ chmod ug=rwx,o= /nix/var/nix/daemon-socket
|
||||
```
|
||||
|
||||
This way, users who are not in the `nix-users` group cannot connect to
|
||||
the Unix domain socket `/nix/var/nix/daemon-socket/socket`, so they
|
||||
cannot perform Nix operations.
|
15
doc/manual/source/installation/nix-security.md
Normal file
15
doc/manual/source/installation/nix-security.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
# Security
|
||||
|
||||
Nix has two basic security models. First, it can be used in “single-user
|
||||
mode”, which is similar to what most other package management tools do:
|
||||
there is a single user (typically root) who performs all package
|
||||
management operations. All other users can then use the installed
|
||||
packages, but they cannot perform package management operations
|
||||
themselves.
|
||||
|
||||
Alternatively, you can configure Nix in “multi-user mode”. In this
|
||||
model, all users can perform package management operations — for
|
||||
instance, every user can install software without requiring root
|
||||
privileges. Nix ensures that this is secure. For instance, it’s not
|
||||
possible for one user to overwrite a package used by another user with a
|
||||
Trojan horse.
|
13
doc/manual/source/installation/obtaining-source.md
Normal file
13
doc/manual/source/installation/obtaining-source.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
# Obtaining the Source
|
||||
|
||||
The most recent sources of Nix can be obtained from its [Git
|
||||
repository](https://github.com/NixOS/nix). For example, the following
|
||||
command will check out the latest revision into a directory called
|
||||
`nix`:
|
||||
|
||||
```console
|
||||
$ git clone https://github.com/NixOS/nix
|
||||
```
|
||||
|
||||
Likewise, specific releases can be obtained from the
|
||||
[tags](https://github.com/NixOS/nix/tags) of the repository.
|
80
doc/manual/source/installation/prerequisites-source.md
Normal file
80
doc/manual/source/installation/prerequisites-source.md
Normal file
|
@ -0,0 +1,80 @@
|
|||
# Prerequisites
|
||||
|
||||
- GNU Autoconf (<https://www.gnu.org/software/autoconf/>) and the
|
||||
autoconf-archive macro collection
|
||||
(<https://www.gnu.org/software/autoconf-archive/>). These are
|
||||
needed to run the bootstrap script.
|
||||
|
||||
- GNU Make.
|
||||
|
||||
- Bash Shell. The `./configure` script relies on bashisms, so Bash is
|
||||
required.
|
||||
|
||||
- A version of GCC or Clang that supports C++20.
|
||||
|
||||
- `pkg-config` to locate dependencies. If your distribution does not
|
||||
provide it, you can get it from
|
||||
<http://www.freedesktop.org/wiki/Software/pkg-config>.
|
||||
|
||||
- The OpenSSL library to calculate cryptographic hashes. If your
|
||||
distribution does not provide it, you can get it from
|
||||
<https://www.openssl.org>.
|
||||
|
||||
- The `libbrotlienc` and `libbrotlidec` libraries to provide
|
||||
implementation of the Brotli compression algorithm. They are
|
||||
available for download from the official repository
|
||||
<https://github.com/google/brotli>.
|
||||
|
||||
- cURL and its library. If your distribution does not provide it, you
|
||||
can get it from <https://curl.haxx.se/>.
|
||||
|
||||
- The SQLite embedded database library, version 3.6.19 or higher. If
|
||||
your distribution does not provide it, please install it from
|
||||
<http://www.sqlite.org/>.
|
||||
|
||||
- The [Boehm garbage collector (`bdw-gc`)](http://www.hboehm.info/gc/) to reduce
|
||||
the evaluator’s memory consumption (optional).
|
||||
|
||||
To enable it, install
|
||||
`pkgconfig` and the Boehm garbage collector, and pass the flag
|
||||
`--enable-gc` to `configure`.
|
||||
|
||||
- The `boost` library of version 1.66.0 or higher. It can be obtained
|
||||
from the official web site <https://www.boost.org/>.
|
||||
|
||||
- The `editline` library of version 1.14.0 or higher. It can be
|
||||
obtained from the its repository
|
||||
<https://github.com/troglobit/editline>.
|
||||
|
||||
- The `libsodium` library for verifying cryptographic signatures
|
||||
of contents fetched from binary caches.
|
||||
It can be obtained from the official web site
|
||||
<https://libsodium.org>.
|
||||
|
||||
- Recent versions of Bison and Flex to build the parser. (This is
|
||||
because Nix needs GLR support in Bison and reentrancy support in
|
||||
Flex.) For Bison, you need version 2.6, which can be obtained from
|
||||
the [GNU FTP server](ftp://alpha.gnu.org/pub/gnu/bison). For Flex,
|
||||
you need version 2.5.35, which is available on
|
||||
[SourceForge](http://lex.sourceforge.net/). Slightly older versions
|
||||
may also work, but ancient versions like the ubiquitous 2.5.4a
|
||||
won't.
|
||||
|
||||
- The `libseccomp` is used to provide syscall filtering on Linux. This
|
||||
is an optional dependency and can be disabled passing a
|
||||
`--disable-seccomp-sandboxing` option to the `configure` script (Not
|
||||
recommended unless your system doesn't support `libseccomp`). To get
|
||||
the library, visit <https://github.com/seccomp/libseccomp>.
|
||||
|
||||
- On 64-bit x86 machines only, `libcpuid` library
|
||||
is used to determine which microarchitecture levels are supported
|
||||
(e.g., as whether to have `x86_64-v2-linux` among additional system types).
|
||||
The library is available from its homepage
|
||||
<http://libcpuid.sourceforge.net>.
|
||||
This is an optional dependency and can be disabled
|
||||
by providing a `--disable-cpuid` to the `configure` script.
|
||||
|
||||
- Unless `./configure --disable-unit-tests` is specified, GoogleTest (GTest) and
|
||||
RapidCheck are required, which are available at
|
||||
<https://google.github.io/googletest/> and
|
||||
<https://github.com/emil-e/rapidcheck> respectively.
|
9
doc/manual/source/installation/single-user.md
Normal file
9
doc/manual/source/installation/single-user.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
# Single-User Mode
|
||||
|
||||
In single-user mode, all Nix operations that access the database in
|
||||
`prefix/var/nix/db` or modify the Nix store in `prefix/store` must be
|
||||
performed under the user ID that owns those directories. This is
|
||||
typically root. (If you install from RPM packages, that’s in fact the
|
||||
default ownership.) However, on single-user machines, it is often
|
||||
convenient to `chown` those directories to your normal user account so
|
||||
that you don’t have to `su` to root all the time.
|
7
doc/manual/source/installation/supported-platforms.md
Normal file
7
doc/manual/source/installation/supported-platforms.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
# Supported Platforms
|
||||
|
||||
Nix is currently supported on the following platforms:
|
||||
|
||||
- Linux (i686, x86\_64, aarch64).
|
||||
|
||||
- macOS (x86\_64, aarch64).
|
165
doc/manual/source/installation/uninstall.md
Normal file
165
doc/manual/source/installation/uninstall.md
Normal file
|
@ -0,0 +1,165 @@
|
|||
# Uninstalling Nix
|
||||
|
||||
## Multi User
|
||||
|
||||
Removing a [multi-user installation](./installing-binary.md#multi-user-installation) depends on the operating system.
|
||||
|
||||
### Linux
|
||||
|
||||
If you are on Linux with systemd:
|
||||
|
||||
1. Remove the Nix daemon service:
|
||||
|
||||
```console
|
||||
sudo systemctl stop nix-daemon.service
|
||||
sudo systemctl disable nix-daemon.socket nix-daemon.service
|
||||
sudo systemctl daemon-reload
|
||||
```
|
||||
|
||||
Remove files created by Nix:
|
||||
|
||||
```console
|
||||
sudo rm -rf /etc/nix /etc/profile.d/nix.sh /etc/tmpfiles.d/nix-daemon.conf /nix ~root/.nix-channels ~root/.nix-defexpr ~root/.nix-profile ~root/.cache/nix
|
||||
```
|
||||
|
||||
Remove build users and their group:
|
||||
|
||||
```console
|
||||
for i in $(seq 1 32); do
|
||||
sudo userdel nixbld$i
|
||||
done
|
||||
sudo groupdel nixbld
|
||||
```
|
||||
|
||||
There may also be references to Nix in
|
||||
|
||||
- `/etc/bash.bashrc`
|
||||
- `/etc/bashrc`
|
||||
- `/etc/profile`
|
||||
- `/etc/zsh/zshrc`
|
||||
- `/etc/zshrc`
|
||||
|
||||
which you may remove.
|
||||
|
||||
### macOS
|
||||
|
||||
> **Updating to macOS 15 Sequoia**
|
||||
>
|
||||
> If you recently updated to macOS 15 Sequoia and are getting
|
||||
> ```console
|
||||
> error: the user '_nixbld1' in the group 'nixbld' does not exist
|
||||
> ```
|
||||
> when running Nix commands, refer to GitHub issue [NixOS/nix#10892](https://github.com/NixOS/nix/issues/10892) for instructions to fix your installation without reinstalling.
|
||||
|
||||
1. If system-wide shell initialisation files haven't been altered since installing Nix, use the backups made by the installer:
|
||||
|
||||
```console
|
||||
sudo mv /etc/zshrc.backup-before-nix /etc/zshrc
|
||||
sudo mv /etc/bashrc.backup-before-nix /etc/bashrc
|
||||
sudo mv /etc/bash.bashrc.backup-before-nix /etc/bash.bashrc
|
||||
```
|
||||
|
||||
Otherwise, edit `/etc/zshrc`, `/etc/bashrc`, and `/etc/bash.bashrc` to remove the lines sourcing `nix-daemon.sh`, which should look like this:
|
||||
|
||||
```bash
|
||||
# Nix
|
||||
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
|
||||
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
|
||||
fi
|
||||
# End Nix
|
||||
```
|
||||
|
||||
2. Stop and remove the Nix daemon services:
|
||||
|
||||
```console
|
||||
sudo launchctl unload /Library/LaunchDaemons/org.nixos.nix-daemon.plist
|
||||
sudo rm /Library/LaunchDaemons/org.nixos.nix-daemon.plist
|
||||
sudo launchctl unload /Library/LaunchDaemons/org.nixos.darwin-store.plist
|
||||
sudo rm /Library/LaunchDaemons/org.nixos.darwin-store.plist
|
||||
```
|
||||
|
||||
This stops the Nix daemon and prevents it from being started next time you boot the system.
|
||||
|
||||
3. Remove the `nixbld` group and the `_nixbuildN` users:
|
||||
|
||||
```console
|
||||
sudo dscl . -delete /Groups/nixbld
|
||||
for u in $(sudo dscl . -list /Users | grep _nixbld); do sudo dscl . -delete /Users/$u; done
|
||||
```
|
||||
|
||||
This will remove all the build users that no longer serve a purpose.
|
||||
|
||||
4. Edit fstab using `sudo vifs` to remove the line mounting the Nix Store volume on `/nix`, which looks like
|
||||
|
||||
```
|
||||
UUID=<uuid> /nix apfs rw,noauto,nobrowse,suid,owners
|
||||
```
|
||||
or
|
||||
|
||||
```
|
||||
LABEL=Nix\040Store /nix apfs rw,nobrowse
|
||||
```
|
||||
|
||||
by setting the cursor on the respective line using the arrow keys, and pressing `dd`, and then `:wq` to save the file.
|
||||
|
||||
This will prevent automatic mounting of the Nix Store volume.
|
||||
|
||||
5. Edit `/etc/synthetic.conf` to remove the `nix` line.
|
||||
If this is the only line in the file you can remove it entirely:
|
||||
|
||||
```bash
|
||||
if [ -f /etc/synthetic.conf ]; then
|
||||
if [ "$(cat /etc/synthetic.conf)" = "nix" ]; then
|
||||
sudo rm /etc/synthetic.conf
|
||||
else
|
||||
sudo vi /etc/synthetic.conf
|
||||
fi
|
||||
fi
|
||||
```
|
||||
|
||||
This will prevent the creation of the empty `/nix` directory.
|
||||
|
||||
6. Remove the files Nix added to your system, except for the store:
|
||||
|
||||
```console
|
||||
sudo rm -rf /etc/nix /var/root/.nix-profile /var/root/.nix-defexpr /var/root/.nix-channels ~/.nix-profile ~/.nix-defexpr ~/.nix-channels
|
||||
```
|
||||
|
||||
|
||||
7. Remove the Nix Store volume:
|
||||
|
||||
```console
|
||||
sudo diskutil apfs deleteVolume /nix
|
||||
```
|
||||
|
||||
This will remove the Nix Store volume and everything that was added to the store.
|
||||
|
||||
If the output indicates that the command couldn't remove the volume, you should make sure you don't have an _unmounted_ Nix Store volume.
|
||||
Look for a "Nix Store" volume in the output of the following command:
|
||||
|
||||
```console
|
||||
diskutil list
|
||||
```
|
||||
|
||||
If you _do_ find a "Nix Store" volume, delete it by running `diskutil apfs deleteVolume` with the store volume's `diskXsY` identifier.
|
||||
|
||||
If you get an error that the volume is in use by the kernel, reboot and immediately delete the volume before starting any other process.
|
||||
|
||||
> **Note**
|
||||
>
|
||||
> After you complete the steps here, you will still have an empty `/nix` directory.
|
||||
> This is an expected sign of a successful uninstall.
|
||||
> The empty `/nix` directory will disappear the next time you reboot.
|
||||
>
|
||||
> You do not have to reboot to finish uninstalling Nix.
|
||||
> The uninstall is complete.
|
||||
> macOS (Catalina+) directly controls root directories, and its read-only root will prevent you from manually deleting the empty `/nix` mountpoint.
|
||||
|
||||
## Single User
|
||||
|
||||
To remove a [single-user installation](./installing-binary.md#single-user-installation) of Nix, run:
|
||||
|
||||
```console
|
||||
$ rm -rf /nix ~/.nix-channels ~/.nix-defexpr ~/.nix-profile
|
||||
```
|
||||
You might also want to manually remove references to Nix from your `~/.profile`.
|
40
doc/manual/source/installation/upgrading.md
Normal file
40
doc/manual/source/installation/upgrading.md
Normal file
|
@ -0,0 +1,40 @@
|
|||
# Upgrading Nix
|
||||
|
||||
> **Note**
|
||||
>
|
||||
> These upgrade instructions apply where Nix was installed following the [installation instructions in this manual](./index.md).
|
||||
|
||||
Check which Nix version will be installed, for example from one of the [release channels](http://channels.nixos.org/) such as `nixpkgs-unstable`:
|
||||
|
||||
```console
|
||||
$ nix-shell -p nix -I nixpkgs=channel:nixpkgs-unstable --run "nix --version"
|
||||
nix (Nix) 2.18.1
|
||||
```
|
||||
|
||||
> **Warning**
|
||||
>
|
||||
> Writing to the [local store](@docroot@/store/types/local-store.md) with a newer version of Nix, for example by building derivations with [`nix-build`](@docroot@/command-ref/nix-build.md) or [`nix-store --realise`](@docroot@/command-ref/nix-store/realise.md), may change the database schema!
|
||||
> Reverting to an older version of Nix may therefore require purging the store database before it can be used.
|
||||
|
||||
## Linux multi-user
|
||||
|
||||
```console
|
||||
$ sudo su
|
||||
# nix-env --install --file '<nixpkgs>' --attr nix cacert -I nixpkgs=channel:nixpkgs-unstable
|
||||
# systemctl daemon-reload
|
||||
# systemctl restart nix-daemon
|
||||
```
|
||||
|
||||
## macOS multi-user
|
||||
|
||||
```console
|
||||
$ sudo nix-env --install --file '<nixpkgs>' --attr nix cacert -I nixpkgs=channel:nixpkgs-unstable
|
||||
$ sudo launchctl remove org.nixos.nix-daemon
|
||||
$ sudo launchctl load /Library/LaunchDaemons/org.nixos.nix-daemon.plist
|
||||
```
|
||||
|
||||
## Single-user all platforms
|
||||
|
||||
```console
|
||||
$ nix-env --install --file '<nixpkgs>' --attr nix cacert -I nixpkgs=channel:nixpkgs-unstable
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue