Operators

The table below lists the operators in the Nix expression language, in order of precedence (from strongest to weakest binding).

NameSyntaxAssociativityDescriptionPrecedence
Selecte . attrpath [ or def ]noneSelect 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.1
Applicatione1 e2leftCall function e1 with argument e2.2
Arithmetic Negation- enoneArithmetic negation.3
Has Attributee ? attrpathnoneTest whether set e contains the attribute denoted by attrpath; return true or false.4
List Concatenatione1 ++ e2rightList concatenation.5
Multiplicatione1 * e2,leftArithmetic multiplication.6
Divisione1 / e2leftArithmetic division.6
Additione1 + e2leftArithmetic addition.7
Subtractione1 - e2leftArithmetic subtraction.7
String Concatenationstring1 + string2leftString concatenation.7
Not! enoneBoolean negation.8
Updatee1 // e2rightReturn a set consisting of the attributes in e1 and e2 (with the latter taking precedence over the former in case of equally named attributes).9
Less Thane1 < e2,noneArithmetic comparison.10
Less Than or Equal Toe1 <= e2noneArithmetic comparison.10
Greater Thane1 > e2noneArithmetic comparison.10
Greater Than or Equal Toe1 >= e2noneArithmetic comparison.10
Equalitye1 == e2noneEquality.11
Inequalitye1 != e2noneInequality.11
Logical ANDe1 && e2leftLogical AND.12
Logical ORe1 \|\| e2leftLogical OR.13
Logical Implicatione1 -> e2noneLogical implication (equivalent to !e1 \|\| e2).14