From 4da7c866181c699b43d3cd2fff0afd2505774be7 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Tue, 27 Jun 2023 09:32:40 -0400 Subject: [PATCH] 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 --- doc/manual/src/language/builtin-constants.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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)