1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-17 07:52:43 +01:00
nix/doc/manual/src/language/builtin-constants.md
Valentin Gagarin 69a0e6f86c reword documentation on builtins
- add anchor to `builtins`
- add type information
- reword description of `builtins` to offer more information concisely
2023-05-11 17:46:37 +02:00

764 B

Built-in Constants

These constants are built into the Nix language evaluator:

  • [builtins]{#builtins-builtins} (attribute set)

    Contains all the built-in functions and values, in order to avoid polluting the global scope.

    Since built-in functions were added over time, testing for attributes in builtins can be used for graceful fallback on older Nix installations:

    if builtins ? getEnv then builtins.getEnv "PATH" else ""
    
  • [builtins.currentSystem]{#builtins-currentSystem} (string)

    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".