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

Int (Integer Atom)

Definition

Int Integer

Fields

FieldTypeDescription
contentsIntegerArbitrary-precision integer (Nix uses 64-bit range)

Nix Source ↔ AST

# Nix
42

# AST (wrapped in Constant)
{
  "tag": "Constant",
  "contents": { "tag": "Int", "contents": 42 }
}
# Nix
-123

# AST (wrapped in Constant)
{
  "tag": "Constant",
  "contents": { "tag": "Int", "contents": -123 }
}

Note

Nix integers are 64-bit signed. The Integer type is arbitrary precision but values are constrained to Nix’s 64-bit range at runtime.

  • Constant: wrapper for atoms in expressions

Nix Library Access

syntax.mkInt 42
syntax.mkConstant (syntax.mkInt 42)