diff options
author | Jasper Ras <jras@hostnet.nl> | 2024-11-23 17:15:20 +0100 |
---|---|---|
committer | Jasper Ras <jras@hostnet.nl> | 2024-11-23 17:15:20 +0100 |
commit | dbe655fca3cf4fc5bc882015006f006764eace52 (patch) | |
tree | d70fe1a94f37103031f7973c0d77fbcecaf52499 /3 resources/programming/Nix.md | |
parent | c5e7a50f1dbf3b541ae5547c50d2ec5707a45ca9 (diff) |
organise most stuff into para dirs
Diffstat (limited to '3 resources/programming/Nix.md')
-rw-r--r-- | 3 resources/programming/Nix.md | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/3 resources/programming/Nix.md b/3 resources/programming/Nix.md new file mode 100644 index 0000000..fca31a8 --- /dev/null +++ b/3 resources/programming/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. + |