aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2023-06-27 09:32:40 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2023-06-27 09:34:36 -0400
commit4da7c866181c699b43d3cd2fff0afd2505774be7 (patch)
tree60649bb193c43f50b78d1d19d60e5a924046f3fd
parente8067daf0955c297f389c968dab3e927b395de07 (diff)
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>
-rw-r--r--doc/manual/src/language/builtin-constants.md3
1 files changed, 2 insertions, 1 deletions
diff --git a/doc/manual/src/language/builtin-constants.md b/doc/manual/src/language/builtin-constants.md
index e6bc7e915..eb8b53bf0 100644
--- a/doc/manual/src/language/builtin-constants.md
+++ b/doc/manual/src/language/builtin-constants.md
@@ -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)