doc/values: Refer to base directory

This commit is contained in:
Robert Hensing 2024-04-19 18:57:25 +02:00
parent 73125e46fc
commit e8d267ad5b

View file

@ -97,8 +97,8 @@
is not a path: it's parsed as an expression that selects the is not a path: it's parsed as an expression that selects the
attribute `sh` from the variable `builder`. If the file name is attribute `sh` from the variable `builder`. If the file name is
relative, i.e., if it does not begin with a slash, it is made relative, i.e., if it does not begin with a slash, it is made
absolute at parse time relative to the directory of the Nix absolute at parse time relative to the [base directory](@docroot@/glossary.md#gloss-base-directory).
expression that contained it. For instance, if a Nix expression in For instance, if a Nix expression in
`/foo/bar/bla.nix` refers to `../xyzzy/fnord.nix`, the absolute path `/foo/bar/bla.nix` refers to `../xyzzy/fnord.nix`, the absolute path
is `/foo/xyzzy/fnord.nix`. is `/foo/xyzzy/fnord.nix`.
@ -107,7 +107,7 @@
e.g. `~/foo` would be equivalent to `/home/edolstra/foo` for a user e.g. `~/foo` would be equivalent to `/home/edolstra/foo` for a user
whose home directory is `/home/edolstra`. whose home directory is `/home/edolstra`.
For instance, evaluating `"${./foo.txt}"` will cause `foo.txt` in the current directory to be copied into the Nix store and result in the string `"/nix/store/<hash>-foo.txt"`. For instance, evaluating `"${./foo.txt}"` will cause `foo.txt` in the base directory to be copied into the Nix store and result in the string `"/nix/store/<hash>-foo.txt"`.
Note that the Nix language assumes that all input files will remain _unchanged_ while evaluating a Nix expression. Note that the Nix language assumes that all input files will remain _unchanged_ while evaluating a Nix expression.
For example, assume you used a file path in an interpolated string during a `nix repl` session. For example, assume you used a file path in an interpolated string during a `nix repl` session.