From 2ef7f14e28258f2f203bbd03af49dd9c07078234 Mon Sep 17 00:00:00 2001 From: Valentin Gagarin Date: Thu, 11 May 2023 15:29:03 +0200 Subject: [PATCH 1/2] do not indent markdown list --- doc/manual/src/language/builtin-constants.md | 30 ++++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/doc/manual/src/language/builtin-constants.md b/doc/manual/src/language/builtin-constants.md index 78d066a82..3898bfd66 100644 --- a/doc/manual/src/language/builtin-constants.md +++ b/doc/manual/src/language/builtin-constants.md @@ -2,19 +2,19 @@ Here are the constants built into the Nix expression evaluator: - - `builtins`\ - 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. +- `builtins`\ + 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. - - [`builtins.currentSystem`]{#builtins-currentSystem}\ - 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"`. +- [`builtins.currentSystem`]{#builtins-currentSystem}\ + 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"`. From 69a0e6f86cd1548a50365744b1d50f01097654ef Mon Sep 17 00:00:00 2001 From: Valentin Gagarin Date: Thu, 11 May 2023 15:41:29 +0200 Subject: [PATCH 2/2] reword documentation on `builtins` - add anchor to `builtins` - add type information - reword description of `builtins` to offer more information concisely --- doc/manual/src/language/builtin-constants.md | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/doc/manual/src/language/builtin-constants.md b/doc/manual/src/language/builtin-constants.md index 3898bfd66..c6bc9b74c 100644 --- a/doc/manual/src/language/builtin-constants.md +++ b/doc/manual/src/language/builtin-constants.md @@ -1,20 +1,19 @@ # Built-in Constants -Here are the constants built into the Nix expression evaluator: +These constants are built into the Nix language evaluator: + +- [`builtins`]{#builtins-builtins} (attribute set) + + Contains all the [built-in functions](./builtins.md) and values, in order to avoid polluting the global scope. + + 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: -- `builtins`\ - 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. -- [`builtins.currentSystem`]{#builtins-currentSystem}\ +- [`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"`.