Navigation

Primitives

Primitive types: String, Int, Bool, Float, Attrs, Path, Derivation, Function, Null, Unit, Any.

Any

Any: top type; every Nix value inhabits it, backed by H.any — used as the lossy fallback kernel for approximate types.

Top type. Every value inhabits Any. Approximate types fall back to Any for their kernel slot.

Attrs

Attrs: primitive type for any Nix attribute set; backed by H.attrs — accepts every attrset including {}, never checks field shape.

Attribute set type. Any attrset, including {}. Use Record for declared-field shape.

Bool

Bool: primitive type whose only inhabitants are true and false; backed by the H.bool kernel type with precise kernel decision.

Boolean type. Inhabited by true and false.

Derivation

Derivation: primitive type for Nix derivation values — attrsets carrying type = "derivation". The store-producing irreducible value category that makes Nix Nix; rejects plain attrsets, strings, and paths.

Derivation type. Nix derivation values (built via mkDerivation / runCommand / stdenv.mkDerivation etc.).

Membership is decided structurally: any attrset with type = "derivation" qualifies. Bare attrsets (no type field), strings (e.g. "pkgs.hello"), and paths (e.g. ./foo) are rejected — derivations are a distinct value category.

Float

Float: primitive type whose values are Nix floating-point numbers; backed by H.float_ and decided by builtins.isFloat (excludes ints).

Float type. Inhabited by Nix floats; rejects integers.

Function

Function: primitive type for Nix lambdas; backed by H.function_ and decided by builtins.isFunction — argument/result shape is not introspected.

Function type. Any Nix lambda. The arrow shape (a -> b) is not checked at this level — use H.forall for that.

Int

Int: primitive type whose values are Nix integers; backed by the H.int_ kernel type and decided by builtins.isInt (excludes floats).

Integer type. Inhabited by Nix integer values; rejects floats.

Null

Null: primitive type whose only inhabitant is null; isomorphic to Unit and backed by the H.unit kernel type.

Null type. Only null inhabits it. Isomorphic to Unit.

Path

Path: primitive type for Nix path values; rejects strings — paths and strings are distinct value categories in Nix.

Path type. Nix path values (e.g. ./foo); not interchangeable with strings.

String

String: primitive type whose values are Nix strings; backed by the H.string kernel type and decided by builtins.isString at the elaborator.

String type. Inhabited by Nix string values.

Unit

Unit: primitive type with one inhabitant null; isomorphic to Null, backed by the H.unit kernel type — the trivial / terminal type.

Unit type. Trivial type with one inhabitant. Isomorphic to Null.