2020-08-24 15:31:10 +03:00
|
|
|
|
# Built-in Constants
|
|
|
|
|
|
|
|
|
|
Here are the constants built into the Nix expression evaluator:
|
|
|
|
|
|
2021-04-23 15:30:42 +03:00
|
|
|
|
- `builtins`\
|
2020-08-24 15:31:10 +03:00
|
|
|
|
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.
|
|
|
|
|
|
2021-04-23 15:30:42 +03:00
|
|
|
|
- `builtins.currentSystem`\
|
2020-08-24 15:31:10 +03:00
|
|
|
|
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"`.
|