reword documentation on nix-path config option#7772
reword documentation on nix-path config option#7772fricklerhandwerk merged 2 commits intoNixOS:masterfrom
nix-path config option#7772Conversation
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/tweag-nix-dev-update-44/25546/1 |
854156a to
d3ff65f
Compare
|
Or we trying to document the current behavior or the intended behavior? Because this to me is not quitethe intended behavior. The rules I wrote in #7871 (comment) are not intended to be just just for Documenting this stuff per a specific option like |
|
I agree this should just follow the standard pattern. But since there are four possibilities of changing the search path, I opted for making that explicit here. We don't have to do it that way, and I'm open for concrete suggestions. |
|
@fricklerhandwerk I am thinking of adding to (Or maybe it would be sub-class.) |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/tweag-nix-dev-update-45/26397/1 |
|
Triaged in the Nix team meeting 2023-03-31:
|
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2023-03-31-nix-team-meeting-minutes-45/27002/1 |
|
🎉 All dependencies have been resolved ! |
d3ff65f to
483d4c1
Compare
483d4c1 to
4706c19
Compare
- put all the information on search path semantics into `builtins.findFile` - put all the information on determining the value of `builtins.nixPath` into the `nix-path` setting maybe `builtins.nixPath` is a better place for this, but those bits can still be moved around now that it's all next to each other. - link to the syntax page for lookup paths from all places that are concerned with it - add or clarify examples - add a test verifying a claim from documentation
4706c19 to
cdcb99f
Compare
| Add *path* to the Nix search path. The Nix search path is | ||
| initialized from the colon-separated [`NIX_PATH`](@docroot@/command-ref/env-common.md#env-NIX_PATH) environment | ||
| variable, and is used to look up the location of Nix expressions using [paths](@docroot@/language/types.md#type-path) enclosed in angle | ||
| brackets (i.e., `<nixpkgs>`). | ||
| Add *path* to search path entries used to resolve [lookup paths](@docroot@/language/constructs/lookup-path.md) | ||
|
|
||
| For instance, passing | ||
| This option may be given multiple times. | ||
|
|
||
| ``` | ||
| -I /home/eelco/Dev | ||
| -I /etc/nixos | ||
| ``` | ||
|
|
||
| will cause Nix to look for paths relative to `/home/eelco/Dev` and | ||
| `/etc/nixos`, in that order. This is equivalent to setting the | ||
| `NIX_PATH` environment variable to | ||
|
|
||
| ``` | ||
| /home/eelco/Dev:/etc/nixos | ||
| ``` | ||
|
|
||
| It is also possible to match paths against a prefix. For example, | ||
| passing | ||
|
|
||
| ``` | ||
| -I nixpkgs=/home/eelco/Dev/nixpkgs-branch | ||
| -I /etc/nixos | ||
| ``` | ||
|
|
||
| will cause Nix to search for `<nixpkgs/path>` in | ||
| `/home/eelco/Dev/nixpkgs-branch/path` and `/etc/nixos/nixpkgs/path`. | ||
|
|
||
| If a path in the Nix search path starts with `http://` or `https://`, | ||
| it is interpreted as the URL of a tarball that will be downloaded and | ||
| unpacked to a temporary location. The tarball must consist of a single | ||
| top-level directory. For example, passing | ||
|
|
||
| ``` | ||
| -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/master.tar.gz | ||
| ``` | ||
|
|
||
| tells Nix to download and use the current contents of the `master` | ||
| branch in the `nixpkgs` repository. | ||
|
|
||
| The URLs of the tarballs from the official `nixos.org` channels | ||
| (see [the manual page for `nix-channel`](../nix-channel.md)) can be | ||
| abbreviated as `channel:<channel-name>`. For instance, the | ||
| following two flags are equivalent: | ||
|
|
||
| ``` | ||
| -I nixpkgs=channel:nixos-21.05 | ||
| -I nixpkgs=https://nixos.org/channels/nixos-21.05/nixexprs.tar.xz | ||
| ``` | ||
|
|
||
| You can also fetch source trees using [flake URLs](./nix3-flake.md#url-like-syntax) and add them to the | ||
| search path. For instance, | ||
|
|
||
| ``` | ||
| -I nixpkgs=flake:nixpkgs | ||
| ``` | ||
|
|
||
| specifies that the prefix `nixpkgs` shall refer to the source tree | ||
| downloaded from the `nixpkgs` entry in the flake registry. Similarly, | ||
|
|
||
| ``` | ||
| -I nixpkgs=flake:github:NixOS/nixpkgs/nixos-22.05 | ||
| ``` | ||
|
|
||
| makes `<nixpkgs>` refer to a particular branch of the | ||
| `NixOS/nixpkgs` repository on GitHub. |
There was a problem hiding this comment.
IMO moving this part to src/libexpr/primops.cc make it harder to understand that -I a=b means search path attrs set { prefix: a, path: b } in https://nix.dev/manual/nix/2.24/language/builtins.html#builtins-findFile.
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/selecting-a-channel-with-nix-shell/4247/9 |
also make the fallback values explicit.
Motivation
this is to clarify behavior. using the positive boolean is easier to read,
as it does not require flipping bits in your head.
Context
Follow-up on #7689 by @ncfavier instead of making a post-factum review.
Update: unfortunately that PR did not actually implement the desired behavior.
Depends on: #7871
Checklist for maintainers
Maintainers: tick if completed or explain if not relevant
tests/**.shsrc/*/teststests/nixos/*