mirror of
https://github.com/NixOS/nix.git
synced 2025-11-30 14:10:59 +01:00
Added using the following sed scripts:
- For command-ref/opt-common.md:
s~- `(--?)([^`]+)`~- [`\1\2`]{#opt-\2}~g
- For expressions/builtin-constants.md:
s~- `(builtins\.?)([^`]+)`~- [`\1\2`]{#builtins-\2}~g
- For expressions/advanced-attributes.md
s~^ - `([^`]+)`~ - [`\1`]{#adv-attr-\1}~g
and manually adjusted outputHashAlgo & outputHashMode.
- For glossary.md
s~^ - (`([^`]+)`|(.+)) ?\\~ - [\1]{#gloss-\2\3}\\~g;
s~(gloss-\w+) ~\1-~g
and manually adjusted anchors for Nix expression, user environment, NAR, ∅ and ε.
- For command-ref/env-common.md
s~^ - `([^`]+)`~ - [`\1`]{#env-\1}~g'
20 lines
764 B
Markdown
20 lines
764 B
Markdown
# Built-in Constants
|
||
|
||
Here are the constants built into the Nix expression evaluator:
|
||
|
||
- `builtins`\
|
||
The set `builtins` contains all the built-in functions and values.
|
||
You can use `builtins` to test for the availability of features in
|
||
the Nix installation, e.g.,
|
||
|
||
```nix
|
||
if builtins ? getEnv then builtins.getEnv "PATH" else ""
|
||
```
|
||
|
||
This allows a Nix expression to fall back gracefully on older Nix
|
||
installations that don’t have the desired built-in function.
|
||
|
||
- [`builtins.currentSystem`]{#builtins-currentSystem}\
|
||
The built-in value `currentSystem` evaluates to the Nix platform
|
||
identifier for the Nix installation on which the expression is being
|
||
evaluated, such as `"i686-linux"` or `"x86_64-darwin"`.
|