about summary refs log tree commit diff
path: root/nix
diff options
context:
space:
mode:
Diffstat (limited to 'nix')
-rw-r--r--nix/nix-1p/README.md23
1 files changed, 23 insertions, 0 deletions
diff --git a/nix/nix-1p/README.md b/nix/nix-1p/README.md
index 93d1c896b204..ef3e97ae1d75 100644
--- a/nix/nix-1p/README.md
+++ b/nix/nix-1p/README.md
@@ -15,6 +15,7 @@ important is missing.
 - [Overview](#overview)
 - [Language constructs](#language-constructs)
     - [Primitives / literals](#primitives--literals)
+    - [Operators](#operators)
     - [Variable bindings](#variable-bindings)
     - [Functions](#functions)
         - [Multiple arguments (currying)](#multiple-arguments-currying)
@@ -104,6 +105,28 @@ second line
 rec { a = 15; b = a * 2; }
 ```
 
+## Operators
+
+Nix has several operators, most of which are unsurprising:
+
+| Syntax               | Description                                                                 |
+|----------------------|-----------------------------------------------------------------------------|
+| `+`, `-`, `*`, `/`   | Numerical operations                                                        |
+| `+`                  | String concatenation                                                        |
+| `++`                 | List concatenation                                                          |
+| `==`                 | Equality                                                                    |
+| `>`, `>=`, `<`, `<=` | Ordering comparators                                                        |
+| `&&`                 | Logical `AND`                                                               |
+| `\|\|`               | Logical `OR`                                                                |
+| `e1 -> e2`           | Logical implication (i.e. `!e1 \|\| e2`)                                    |
+| `!`                  | Boolean negation                                                            |
+| `set.attr`           | Access attribute `attr` in attribute set `set`                              |
+| `set ? attribute`    | Test whether attribute set contains an attribute                            |
+| `left // right`      | Merge `left` & `right` attribute sets, with the right set taking precedence |
+
+Make sure to understand the `//`-operator, as it is used quite a lot and is
+probably the least familiar one.
+
 ## Variable bindings
 
 Bindings in Nix are introduced locally via `let` expressions, which make some