mirror of
https://github.com/NixOS/nix
synced 2025-06-26 07:31:15 +02:00
Enable syntax highlighting
This commit is contained in:
parent
0c94c17644
commit
1d0a7b54fa
46 changed files with 1770 additions and 1155 deletions
|
@ -3,16 +3,20 @@
|
|||
After unpacking or checking out the Nix sources, issue the following
|
||||
commands:
|
||||
|
||||
$ ./configure options...
|
||||
$ make
|
||||
$ make install
|
||||
```console
|
||||
$ ./configure options...
|
||||
$ make
|
||||
$ make install
|
||||
```
|
||||
|
||||
Nix requires GNU Make so you may need to invoke `gmake` instead.
|
||||
|
||||
When building from the Git repository, these should be preceded by the
|
||||
command:
|
||||
|
||||
$ ./bootstrap.sh
|
||||
```console
|
||||
$ ./bootstrap.sh
|
||||
```
|
||||
|
||||
The installation path can be specified by passing the `--prefix=prefix`
|
||||
to `configure`. The default installation directory is `/usr/local`. You
|
||||
|
|
|
@ -10,7 +10,9 @@ environment variables is to include the file
|
|||
`prefix/etc/profile.d/nix.sh` in your `~/.profile` (or similar), like
|
||||
this:
|
||||
|
||||
source prefix/etc/profile.d/nix.sh
|
||||
```bash
|
||||
source prefix/etc/profile.d/nix.sh
|
||||
```
|
||||
|
||||
# `NIX_SSL_CERT_FILE`
|
||||
|
||||
|
@ -23,13 +25,17 @@ and use its own certificate bundle.
|
|||
|
||||
Set the environment variable and install Nix
|
||||
|
||||
$ export NIX_SSL_CERT_FILE=/etc/ssl/my-certificate-bundle.crt
|
||||
$ sh <(curl -L https://nixos.org/nix/install)
|
||||
```console
|
||||
$ export NIX_SSL_CERT_FILE=/etc/ssl/my-certificate-bundle.crt
|
||||
$ sh <(curl -L https://nixos.org/nix/install)
|
||||
```
|
||||
|
||||
In the shell profile and rc files (for example, `/etc/bashrc`,
|
||||
`/etc/zshrc`), add the following line:
|
||||
|
||||
export NIX_SSL_CERT_FILE=/etc/ssl/my-certificate-bundle.crt
|
||||
```bash
|
||||
export NIX_SSL_CERT_FILE=/etc/ssl/my-certificate-bundle.crt
|
||||
```
|
||||
|
||||
> **Note**
|
||||
>
|
||||
|
@ -41,8 +47,10 @@ In the shell profile and rc files (for example, `/etc/bashrc`,
|
|||
On macOS you must specify the environment variable for the Nix daemon
|
||||
service, then restart it:
|
||||
|
||||
$ sudo launchctl setenv NIX_SSL_CERT_FILE /etc/ssl/my-certificate-bundle.crt
|
||||
$ sudo launchctl kickstart -k system/org.nixos.nix-daemon
|
||||
```console
|
||||
$ sudo launchctl setenv NIX_SSL_CERT_FILE /etc/ssl/my-certificate-bundle.crt
|
||||
$ sudo launchctl kickstart -k system/org.nixos.nix-daemon
|
||||
```
|
||||
|
||||
## Proxy Environment Variables
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
If you are using Linux or macOS versions up to 10.14 (Mojave), the
|
||||
easiest way to install Nix is to run the following command:
|
||||
|
||||
```
|
||||
$ sh <(curl -L https://nixos.org/nix/install)
|
||||
```console
|
||||
$ sh <(curl -L https://nixos.org/nix/install)
|
||||
```
|
||||
|
||||
If you're using macOS 10.15 (Catalina) or newer, consult [the macOS
|
||||
|
@ -18,8 +18,8 @@ installation is highly recommended.
|
|||
|
||||
To explicitly select a single-user installation on your system:
|
||||
|
||||
```
|
||||
sh <(curl -L https://nixos.org/nix/install) --no-daemon
|
||||
```console
|
||||
$ sh <(curl -L https://nixos.org/nix/install) --no-daemon
|
||||
```
|
||||
|
||||
This will perform a single-user installation of Nix, meaning that `/nix`
|
||||
|
@ -28,8 +28,10 @@ account, *not* as root. The script will invoke `sudo` to create `/nix`
|
|||
if it doesn’t already exist. If you don’t have `sudo`, you should
|
||||
manually create `/nix` first as root, e.g.:
|
||||
|
||||
$ mkdir /nix
|
||||
$ chown alice /nix
|
||||
```console
|
||||
$ mkdir /nix
|
||||
$ chown alice /nix
|
||||
```
|
||||
|
||||
The install script will modify the first writable file from amongst
|
||||
`.bash_profile`, `.bash_login` and `.profile` to source
|
||||
|
@ -39,7 +41,9 @@ the install script to disable this behaviour.
|
|||
|
||||
You can uninstall Nix simply by running:
|
||||
|
||||
$ rm -rf /nix
|
||||
```console
|
||||
$ rm -rf /nix
|
||||
```
|
||||
|
||||
# Multi User Installation
|
||||
|
||||
|
@ -53,7 +57,9 @@ service for the Nix daemon.
|
|||
You can instruct the installer to perform a multi-user installation on
|
||||
your system:
|
||||
|
||||
sh <(curl -L https://nixos.org/nix/install) --daemon
|
||||
```console
|
||||
$ sh <(curl -L https://nixos.org/nix/install) --daemon
|
||||
```
|
||||
|
||||
The multi-user installation of Nix will create build users between the
|
||||
user IDs 30001 and 30032, and a group with the group ID 30000. You
|
||||
|
@ -72,18 +78,20 @@ extension. The installer will also create `/etc/profile.d/nix.sh`.
|
|||
|
||||
You can uninstall Nix with the following commands:
|
||||
|
||||
sudo rm -rf /etc/profile/nix.sh /etc/nix /nix ~root/.nix-profile ~root/.nix-defexpr ~root/.nix-channels ~/.nix-profile ~/.nix-defexpr ~/.nix-channels
|
||||
|
||||
# If you are on Linux with systemd, you will need to run:
|
||||
sudo systemctl stop nix-daemon.socket
|
||||
sudo systemctl stop nix-daemon.service
|
||||
sudo systemctl disable nix-daemon.socket
|
||||
sudo systemctl disable nix-daemon.service
|
||||
sudo systemctl daemon-reload
|
||||
|
||||
# If you are on macOS, you will need to run:
|
||||
sudo launchctl unload /Library/LaunchDaemons/org.nixos.nix-daemon.plist
|
||||
sudo rm /Library/LaunchDaemons/org.nixos.nix-daemon.plist
|
||||
```console
|
||||
sudo rm -rf /etc/profile/nix.sh /etc/nix /nix ~root/.nix-profile ~root/.nix-defexpr ~root/.nix-channels ~/.nix-profile ~/.nix-defexpr ~/.nix-channels
|
||||
|
||||
# If you are on Linux with systemd, you will need to run:
|
||||
sudo systemctl stop nix-daemon.socket
|
||||
sudo systemctl stop nix-daemon.service
|
||||
sudo systemctl disable nix-daemon.socket
|
||||
sudo systemctl disable nix-daemon.service
|
||||
sudo systemctl daemon-reload
|
||||
|
||||
# If you are on macOS, you will need to run:
|
||||
sudo launchctl unload /Library/LaunchDaemons/org.nixos.nix-daemon.plist
|
||||
sudo rm /Library/LaunchDaemons/org.nixos.nix-daemon.plist
|
||||
```
|
||||
|
||||
There may also be references to Nix in `/etc/profile`, `/etc/bashrc`,
|
||||
and `/etc/zshrc` which you may remove.
|
||||
|
@ -110,7 +118,9 @@ chip](https://www.apple.com/euro/mac/shared/docs/Apple_T2_Security_Chip_Overview
|
|||
your drive will still be encrypted at rest (in which case "unencrypted"
|
||||
is a bit of a misnomer). To use this approach, just install Nix with:
|
||||
|
||||
$ sh <(curl -L https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume
|
||||
```console
|
||||
$ sh <(curl -L https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume
|
||||
```
|
||||
|
||||
If you don't like the sound of this, you'll want to weigh the other
|
||||
approaches and tradeoffs detailed in this section.
|
||||
|
@ -184,7 +194,9 @@ there are a few things to weigh:
|
|||
If you are comfortable navigating these tradeoffs, you can encrypt the
|
||||
volume with something along the lines of:
|
||||
|
||||
alice$ diskutil apfs enableFileVault /nix -user disk
|
||||
```console
|
||||
alice$ diskutil apfs enableFileVault /nix -user disk
|
||||
```
|
||||
|
||||
## Symlink the Nix store to a custom location
|
||||
|
||||
|
@ -221,11 +233,15 @@ as a helpful reference if you run into trouble.
|
|||
`apfs.util` to trigger creation (not deletion) of new entries
|
||||
without a reboot:
|
||||
|
||||
alice$ /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -B
|
||||
```console
|
||||
alice$ /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -B
|
||||
```
|
||||
|
||||
3. Create the new APFS volume with diskutil:
|
||||
|
||||
alice$ sudo diskutil apfs addVolume diskX APFS 'Nix Store' -mountpoint /nix
|
||||
```console
|
||||
alice$ sudo diskutil apfs addVolume diskX APFS 'Nix Store' -mountpoint /nix
|
||||
```
|
||||
|
||||
4. Using `vifs`, add the new mount to `/etc/fstab`. If it doesn't
|
||||
already have other entries, it should look something like:
|
||||
|
@ -248,8 +264,8 @@ since 1.11.16, at `https://releases.nixos.org/nix/nix-version/install`.
|
|||
These install scripts can be used the same as the main NixOS.org
|
||||
installation script:
|
||||
|
||||
```
|
||||
sh <(curl -L https://nixos.org/nix/install)
|
||||
```console
|
||||
$ sh <(curl -L https://nixos.org/nix/install)
|
||||
```
|
||||
|
||||
In the same directory of the install script are sha256 sums, and gpg
|
||||
|
@ -263,10 +279,12 @@ dependencies. (This is what the install script at
|
|||
it somewhere (e.g. in `/tmp`), and then run the script named `install`
|
||||
inside the binary tarball:
|
||||
|
||||
alice$ cd /tmp
|
||||
alice$ tar xfj nix-1.8-x86_64-darwin.tar.bz2
|
||||
alice$ cd nix-1.8-x86_64-darwin
|
||||
alice$ ./install
|
||||
```console
|
||||
alice$ cd /tmp
|
||||
alice$ tar xfj nix-1.8-x86_64-darwin.tar.bz2
|
||||
alice$ cd nix-1.8-x86_64-darwin
|
||||
alice$ ./install
|
||||
```
|
||||
|
||||
If you need to edit the multi-user installation script to use different
|
||||
group ID or a different user ID range, modify the variables set in the
|
||||
|
|
|
@ -28,10 +28,12 @@ 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:
|
||||
|
||||
$ 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
|
||||
```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
|
||||
|
@ -42,7 +44,9 @@ expect to do many builds at the same time.
|
|||
The [Nix daemon](../command-ref/nix-daemon.md) should be started as
|
||||
follows (as `root`):
|
||||
|
||||
$ nix-daemon
|
||||
```console
|
||||
$ nix-daemon
|
||||
```
|
||||
|
||||
You’ll want to put that line somewhere in your system’s boot scripts.
|
||||
|
||||
|
@ -50,7 +54,9 @@ 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
|
||||
|
||||
export NIX_REMOTE=daemon
|
||||
```console
|
||||
export NIX_REMOTE=daemon
|
||||
```
|
||||
|
||||
into the users’ login scripts.
|
||||
|
||||
|
@ -61,8 +67,10 @@ 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
|
||||
|
||||
$ chgrp nix-users /nix/var/nix/daemon-socket
|
||||
$ chmod ug=rwx,o= /nix/var/nix/daemon-socket
|
||||
```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
|
||||
|
|
|
@ -10,7 +10,9 @@ Alternatively, the most recent sources of Nix can be obtained from its
|
|||
following command will check out the latest revision into a directory
|
||||
called `nix`:
|
||||
|
||||
$ git clone https://github.com/NixOS/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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue