Switch example to a primop this is less ill-advised

Any primop will do for this, so might as well use one that isn't impure.

Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
This commit is contained in:
John Ericson 2023-06-27 09:32:40 -04:00
parent e8067daf09
commit 4da7c86618

View file

@ -9,7 +9,8 @@ These constants are built into the Nix language evaluator:
Since built-in functions were added over time, [testing for attributes](./operators.md#has-attribute) in `builtins` can be used for graceful fallback on older Nix installations:
```nix
if builtins ? getEnv then builtins.getEnv "PATH" else ""
# if hasContext is not available, we assume `s` has a context
if builtins ? hasContext then builtins.hasContext s else true
```
- [`builtins.currentSystem`]{#builtins-currentSystem} (string)