about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2023-06-19T22·14+0300
committerclbot <clbot@tvl.fyi>2023-06-19T22·20+0000
commit09486d483c7ad3e4f873f684ffa62e634a7ee519 (patch)
treee1c2b6059d3b873fe623edc0772426c8e6867973
parentad687ccaf49f6cfd3b23083ddd543a840c2212ae (diff)
docs(nix-1p): import is a builtin, not a keyword r/6334
Pointed out by @Gaelan on GH in
https://github.com/tazjin/nix-1p/issues/12

As noted there, some Nix syntax highlighters will colour `import`
differently (e.g. the Emacs nix-mode), but it's not technically a
keyword in the language.

Change-Id: I1bbd36261cda31deb9ba47380a2810e64ba03ea1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8832
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
-rw-r--r--nix/nix-1p/README.md6
1 files changed, 4 insertions, 2 deletions
diff --git a/nix/nix-1p/README.md b/nix/nix-1p/README.md
index e7cf1e2d90d0..f102bfd7aa93 100644
--- a/nix/nix-1p/README.md
+++ b/nix/nix-1p/README.md
@@ -325,8 +325,8 @@ in with attrs; a + b # 'a' and 'b' become variables in the scope following 'with
 
 ## `import` / `NIX_PATH` / `<entry>`
 
-Nix files can import each other by using the `import` keyword and a literal
-path:
+Nix files can import each other by using the builtin `import` function and a
+literal path:
 
 ```nix
 # assuming there is a file lib.nix with some useful functions
@@ -334,6 +334,8 @@ let myLib = import ./lib.nix;
 in myLib.usefulFunction 42
 ```
 
+The `import` function will read and evaluate the file, and return its Nix value.
+
 Nix files often begin with a function header to pass parameters into the rest of
 the file, so you will often see imports of the form `import ./some-file { ... }`.