Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Atom

Constructors

ConstructorFieldTypeDescription
BoolcontentsBoolBoolean value (true/false)
FloatcontentsFloatFloating-point (not in Nix surface syntax)
IntcontentsInteger64-bit integer
Null(none)-Null value
UricontentsTextURI literal

Description

Atoms are the primitive constant values in Nix. They are always wrapped in a Constant expression node when used as expressions.

{
  "tag": "Constant",
  "contents": { "tag": "Int", "contents": 42 }
}

Pages

  • Constant: expression wrapper for atoms

Nix Library Access

syntax.mkInt 42
syntax.mkBool true
syntax.mkNull
syntax.mkUri "https://example.com"
syntax.mkFloat 3.14

# Wrapped in Constant
syntax.mkConstant (syntax.mkInt 42)