From 09486d483c7ad3e4f873f684ffa62e634a7ee519 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 20 Jun 2023 01:14:59 +0300 Subject: docs(nix-1p): import is a builtin, not a keyword 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 Autosubmit: tazjin Tested-by: BuildkiteCI --- nix/nix-1p/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'nix/nix-1p/README.md') 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` / `` -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 { ... }`. -- cgit 1.4.1