summaryrefslogtreecommitdiff
path: root/Nix.md
diff options
context:
space:
mode:
authorJasper Ras <jras@hostnet.nl>2024-08-21 16:22:08 +0200
committerJasper Ras <jras@hostnet.nl>2024-08-21 16:22:08 +0200
commitf3711a93832df46dc245075df08b9ebfc05266e9 (patch)
tree167c4c4a9bedd6b94392b20eb6e68bc38656d456 /Nix.md
parent26b2ee8fe95026e84bd1721910d575db72cc1b3f (diff)
forgot to commit for a while
Diffstat (limited to 'Nix.md')
-rw-r--r--Nix.md16
1 files changed, 16 insertions, 0 deletions
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 <file>.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.
+