Synopsis

affogato eval [-h] [--json] [--raw] [--show-trace] [--strict] [-A=ATTR] [--system=SYS] [--arg=NAME EXPR]…​ [--argstr=NAME VALUE]…​ [-I=PATH]…​ (-E=EXPR | FILE)

Description

Evaluate an expression and print the result, like nix-instantiate --eval.

Options

-A, --attr=ATTR

Select an attribute path in the result.

--arg=NAME EXPR

Call a function result with NAME bound to EXPR.

--argstr=NAME VALUE

Call a function result with NAME bound to the string VALUE.

-E, --expr=EXPR

Evaluate EXPR.

-h, --help

Show this help and exit.

-I, --include=PATH

Add an entry to the search path of lookups such as <nixpkgs>, as nixpkgs=/path/to/nixpkgs; the entries of NIX_PATH come after.

--json

Print the result as JSON.

--raw

Print a string result without quotes or escapes.

--show-trace

Print the Nix call stack when the evaluation fails.

--strict

Force the result deeply before printing it.

--system=SYS

Set builtins.currentSystem.

Arguments

FILE

Evaluate FILE, or the default.nix of a directory.

Exit status

0

The evaluation succeeded.

1

The evaluation failed.

2

The command line is invalid.

Engine options

Any other --name or --name=value option goes to the GraalVM polyglot engine, as name=true or name=value. This includes the language’s own --nix.* options and the Truffle tools, such as --inspect for the Chrome DevTools debugger and --cpusampler to profile the evaluation.

Runtime compilation is off by default: on nixpkgs it made evaluations 4 to 10% slower for 1.5 times the CPU and memory. --engine.Compilation=true turns it back on.