Operators
lists the operators in the
Nix expression language, in order of precedence (from strongest to
weakest binding).
Operators
Syntax
Associativity
Description
e .
attrpath
[ or def ]
none
Select attribute denoted by the attribute path
attrpath from set
e. (An attribute path is a
dot-separated list of attribute names.) If the attribute
doesn’t exist, return def if
provided, otherwise abort evaluation.
e1 e2
left
Call function e1 with
argument e2.
- e
none
Arithmetic negation.
e ?
attrpath
none
Test whether set e contains
the attribute denoted by attrpath;
return true or
false.
e1 ++ e2
right
List concatenation.
e1 * e2,
e1 / e2
left
Arithmetic multiplication and division.
e1 + e2,
e1 - e2
left
Arithmetic addition and subtraction. String or path concatenation (only by +).
! e
none
Boolean negation.
e1 //
e2
right
Return a set consisting of the attributes in
e1 and
e2 (with the latter taking
precedence over the former in case of equally named
attributes).
e1 < e2,
e1 > e2,
e1 <= e2,
e1 >= e2
none
Arithmetic comparison.
e1 == e2,
e1 != e2
none
Equality and inequality.
e1 &&
e2
left
Logical AND.
e1 ||
e2
left
Logical OR.
e1 ->
e2
none
Logical implication (equivalent to
!e1 ||
e2).