nix-super/doc/manual/source/installation/env-variables.md

63 lines
2 KiB
Markdown
Raw Permalink Normal View History

2020-07-23 00:17:48 +03:00
# Environment Variables
To use Nix, some environment variables should be set. In particular,
2020-07-23 11:44:54 +03:00
`PATH` should contain the directories `prefix/bin` and
2020-07-23 00:17:48 +03:00
`~/.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:
2020-07-31 16:43:25 +03:00
```bash
source prefix/etc/profile.d/nix.sh
```
2020-07-23 00:17:48 +03:00
2020-07-23 11:44:54 +03:00
# `NIX_SSL_CERT_FILE`
2020-07-23 00:17:48 +03:00
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
2020-07-23 11:44:54 +03:00
the certificate bundle in the environment variable `NIX_SSL_CERT_FILE`.
2020-07-23 00:17:48 +03:00
2020-07-23 11:44:54 +03:00
If you don't specify a `NIX_SSL_CERT_FILE` manually, Nix will install
2020-07-23 00:17:48 +03:00
and use its own certificate bundle.
Set the environment variable and install Nix
2020-07-31 16:43:25 +03:00
```console
$ export NIX_SSL_CERT_FILE=/etc/ssl/my-certificate-bundle.crt
$ curl -L https://nixos.org/nix/install | sh
2020-07-31 16:43:25 +03:00
```
2020-07-23 00:17:48 +03:00
In the shell profile and rc files (for example, `/etc/bashrc`,
`/etc/zshrc`), add the following line:
2020-07-31 16:43:25 +03:00
```bash
export NIX_SSL_CERT_FILE=/etc/ssl/my-certificate-bundle.crt
```
2020-07-23 00:17:48 +03:00
> **Note**
>
2020-07-23 00:17:48 +03:00
> You must not add the export and then do the install, as the Nix
2021-10-03 13:19:59 +03:00
> installer will detect the presence of Nix configuration, and abort.
2020-07-23 00:17:48 +03:00
If you use the Nix daemon, you should also add the following to
`/etc/nix/nix.conf`:
2020-07-23 00:17:48 +03:00
```
ssl-cert-file = /etc/ssl/my-certificate-bundle.crt
2020-07-31 16:43:25 +03:00
```
2020-07-23 00:17:48 +03:00
## 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`.
2020-07-23 00:17:48 +03:00
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.