From 5a75aa8595e5762187b1196454f37959febb7b1d Mon Sep 17 00:00:00 2001 From: Andrei Boar Date: Thu, 4 Aug 2022 14:19:51 +0300 Subject: [PATCH 1/8] manual: update docs when NIX_PATH is empty --- doc/manual/src/command-ref/env-common.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/manual/src/command-ref/env-common.md b/doc/manual/src/command-ref/env-common.md index 3f3eb6915..6280fb1c9 100644 --- a/doc/manual/src/command-ref/env-common.md +++ b/doc/manual/src/command-ref/env-common.md @@ -44,6 +44,12 @@ Most Nix commands interpret the following environment variables: The Nix search path can also be extended using the `-I` option to many Nix commands, which takes precedence over `NIX_PATH`. + If `NIX_PATH` is not set or empty, Nix will look up the following locations for a revision of `nixpkgs`: + + 1. `$HOME/.nix-defexpr/channels` + 2. `/nix/var/nix/profiles/per-user/root/channels/nixpkgs` + 3. `/nix/var/nix/profiles/per-user/root/channels.` + - [`NIX_IGNORE_SYMLINK_STORE`]{#env-NIX_IGNORE_SYMLINK_STORE}\ Normally, the Nix store directory (typically `/nix/store`) is not allowed to contain any symlink components. This is to prevent From 6dfd8a78d91bb384b870bbd218bb44aca0780bb0 Mon Sep 17 00:00:00 2001 From: Andrei Boar Date: Thu, 4 Aug 2022 15:04:52 +0300 Subject: [PATCH 2/8] Update doc/manual/src/command-ref/env-common.md Co-authored-by: Eelco Dolstra --- doc/manual/src/command-ref/env-common.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/manual/src/command-ref/env-common.md b/doc/manual/src/command-ref/env-common.md index 6280fb1c9..286ab9041 100644 --- a/doc/manual/src/command-ref/env-common.md +++ b/doc/manual/src/command-ref/env-common.md @@ -48,7 +48,7 @@ Most Nix commands interpret the following environment variables: 1. `$HOME/.nix-defexpr/channels` 2. `/nix/var/nix/profiles/per-user/root/channels/nixpkgs` - 3. `/nix/var/nix/profiles/per-user/root/channels.` + 3. `/nix/var/nix/profiles/per-user/root/channels` - [`NIX_IGNORE_SYMLINK_STORE`]{#env-NIX_IGNORE_SYMLINK_STORE}\ Normally, the Nix store directory (typically `/nix/store`) is not From f72545e8645b8edf9b638e115de081ccec21b76a Mon Sep 17 00:00:00 2001 From: Andrei Boar Date: Thu, 4 Aug 2022 15:56:01 +0300 Subject: [PATCH 3/8] update to suggested changes --- doc/manual/src/command-ref/env-common.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/manual/src/command-ref/env-common.md b/doc/manual/src/command-ref/env-common.md index 6280fb1c9..a31435578 100644 --- a/doc/manual/src/command-ref/env-common.md +++ b/doc/manual/src/command-ref/env-common.md @@ -44,7 +44,7 @@ Most Nix commands interpret the following environment variables: The Nix search path can also be extended using the `-I` option to many Nix commands, which takes precedence over `NIX_PATH`. - If `NIX_PATH` is not set or empty, Nix will look up the following locations for a revision of `nixpkgs`: + If `NIX_PATH` environment variable is not set, Nix will fall back to the following list in impure and unrestricted evaluation mode: 1. `$HOME/.nix-defexpr/channels` 2. `/nix/var/nix/profiles/per-user/root/channels/nixpkgs` From a8ac6a41201733377de5e95b330ec1a19fde871d Mon Sep 17 00:00:00 2001 From: Andrei Boar Date: Thu, 4 Aug 2022 16:01:02 +0300 Subject: [PATCH 4/8] Update doc/manual/src/command-ref/env-common.md Co-authored-by: Valentin Gagarin --- doc/manual/src/command-ref/env-common.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/manual/src/command-ref/env-common.md b/doc/manual/src/command-ref/env-common.md index 9d3d0caf7..18f70746a 100644 --- a/doc/manual/src/command-ref/env-common.md +++ b/doc/manual/src/command-ref/env-common.md @@ -44,7 +44,7 @@ Most Nix commands interpret the following environment variables: The Nix search path can also be extended using the `-I` option to many Nix commands, which takes precedence over `NIX_PATH`. - If `NIX_PATH` environment variable is not set, Nix will fall back to the following list in impure and unrestricted evaluation mode: + If `NIX_PATH` is not set at all, Nix will fall back to the following list in impure and unrestricted evaluation mode: 1. `$HOME/.nix-defexpr/channels` 2. `/nix/var/nix/profiles/per-user/root/channels/nixpkgs` From 1c2c1a6e009eff7b19f00a3780891a3197d33e28 Mon Sep 17 00:00:00 2001 From: Andrei Boar Date: Thu, 4 Aug 2022 16:17:24 +0300 Subject: [PATCH 5/8] Update doc/manual/src/command-ref/env-common.md Co-authored-by: Jan Tojnar --- doc/manual/src/command-ref/env-common.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/manual/src/command-ref/env-common.md b/doc/manual/src/command-ref/env-common.md index 18f70746a..7b6c05dfb 100644 --- a/doc/manual/src/command-ref/env-common.md +++ b/doc/manual/src/command-ref/env-common.md @@ -47,7 +47,7 @@ Most Nix commands interpret the following environment variables: If `NIX_PATH` is not set at all, Nix will fall back to the following list in impure and unrestricted evaluation mode: 1. `$HOME/.nix-defexpr/channels` - 2. `/nix/var/nix/profiles/per-user/root/channels/nixpkgs` + 2. `nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixpkgs` 3. `/nix/var/nix/profiles/per-user/root/channels` - [`NIX_IGNORE_SYMLINK_STORE`]{#env-NIX_IGNORE_SYMLINK_STORE}\ From 82b867d0b5417ed42485b39b2bacd55fb390d61b Mon Sep 17 00:00:00 2001 From: Andrei Boar Date: Fri, 19 Aug 2022 11:51:32 +0300 Subject: [PATCH 6/8] cover empty string case --- doc/manual/src/command-ref/env-common.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/manual/src/command-ref/env-common.md b/doc/manual/src/command-ref/env-common.md index 7b6c05dfb..4846f3a10 100644 --- a/doc/manual/src/command-ref/env-common.md +++ b/doc/manual/src/command-ref/env-common.md @@ -46,9 +46,13 @@ Most Nix commands interpret the following environment variables: If `NIX_PATH` is not set at all, Nix will fall back to the following list in impure and unrestricted evaluation mode: - 1. `$HOME/.nix-defexpr/channels` - 2. `nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixpkgs` - 3. `/nix/var/nix/profiles/per-user/root/channels` + 1. `$HOME/.nix-defexpr/channels` + 2. `nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixpkgs` + 3. `/nix/var/nix/profiles/per-user/root/channels` + + If `NIX_PATH` is set to an empty string the above fallback will not happen and building will fail with: + + `error: file 'nixpkgs' was not found in the Nix search path` - [`NIX_IGNORE_SYMLINK_STORE`]{#env-NIX_IGNORE_SYMLINK_STORE}\ Normally, the Nix store directory (typically `/nix/store`) is not From 50f5b6c733788b83fd7c64d0dcf77ecd0bb90462 Mon Sep 17 00:00:00 2001 From: Andrei Boar Date: Fri, 19 Aug 2022 12:28:51 +0300 Subject: [PATCH 7/8] Update doc/manual/src/command-ref/env-common.md Co-authored-by: Valentin Gagarin --- doc/manual/src/command-ref/env-common.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/manual/src/command-ref/env-common.md b/doc/manual/src/command-ref/env-common.md index 4846f3a10..c592233e4 100644 --- a/doc/manual/src/command-ref/env-common.md +++ b/doc/manual/src/command-ref/env-common.md @@ -50,9 +50,10 @@ Most Nix commands interpret the following environment variables: 2. `nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixpkgs` 3. `/nix/var/nix/profiles/per-user/root/channels` - If `NIX_PATH` is set to an empty string the above fallback will not happen and building will fail with: + If `NIX_PATH` is set to an empty string, resolving search paths will always fail. + For example, attempting to use `` will produce: - `error: file 'nixpkgs' was not found in the Nix search path` + error: file 'nixpkgs' was not found in the Nix search path - [`NIX_IGNORE_SYMLINK_STORE`]{#env-NIX_IGNORE_SYMLINK_STORE}\ Normally, the Nix store directory (typically `/nix/store`) is not From 96129246ad7d64241a84d900aec5b105f9408f45 Mon Sep 17 00:00:00 2001 From: Valentin Gagarin Date: Wed, 22 Mar 2023 23:37:27 +0100 Subject: [PATCH 8/8] add links --- doc/manual/src/command-ref/env-common.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/manual/src/command-ref/env-common.md b/doc/manual/src/command-ref/env-common.md index c592233e4..983079794 100644 --- a/doc/manual/src/command-ref/env-common.md +++ b/doc/manual/src/command-ref/env-common.md @@ -44,7 +44,7 @@ Most Nix commands interpret the following environment variables: The Nix search path can also be extended using the `-I` option to many Nix commands, which takes precedence over `NIX_PATH`. - If `NIX_PATH` is not set at all, Nix will fall back to the following list in impure and unrestricted evaluation mode: + If `NIX_PATH` is not set at all, Nix will fall back to the following list in [impure](./conf-file.md#conf-pure-eval) and [unrestricted](./conf-file.md#conf-restrict-eval) evaluation mode: 1. `$HOME/.nix-defexpr/channels` 2. `nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixpkgs`