From f3711a93832df46dc245075df08b9ebfc05266e9 Mon Sep 17 00:00:00 2001 From: Jasper Ras Date: Wed, 21 Aug 2024 16:22:08 +0200 Subject: forgot to commit for a while --- Nix.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Nix.md (limited to 'Nix.md') diff --git a/Nix.md b/Nix.md new file mode 100644 index 0000000..fca31a8 --- /dev/null +++ b/Nix.md @@ -0,0 +1,16 @@ + `nix repl` to interactively evaluate Nix expressions. `:p` if output is not full. + `nix-instantiate --eval .nix` to evaluate a Nix expression from a file. `--strict`. + +Nix is like JSON, but with functions. +Recursive attribute sets can reference values declared earlier in the same set. +```nix +rec { + one = 1; + two = one + 1; +} +``` + +A `let` binding is used to assign names to values just as attribute sets, they can then be used in expressions. Let bindings have a local scope. + +A `with` allows referencing attributes of attribute sets without referencing the set. + -- cgit v1.2.3