LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

nix-instantiate

instantiates Nix expressions, producing store derivations

TLDR

Instantiate expression
$ nix-instantiate [expression.nix]
copy
Evaluate and print
$ nix-instantiate --eval [expression.nix]
copy
Evaluate to JSON
$ nix-instantiate --eval --json [expression.nix]
copy
Parse only (check syntax)
$ nix-instantiate --parse [expression.nix]
copy
Use expression from command line
$ nix-instantiate --eval -E '1 + 2'
copy

SYNOPSIS

nix-instantiate [options] files...

DESCRIPTION

nix-instantiate instantiates Nix expressions, producing store derivations. With --eval, it evaluates expressions and prints results.This is useful for debugging and testing Nix expressions.

PARAMETERS

--eval

Evaluate and print result.
--json
Output as JSON.
--strict
Evaluate strictly.
--parse
Parse only.
-E expr
Evaluate expression.
--arg name value
Pass argument.
-A attr
Select attribute.

Evaluate expression

nix-instantiate --eval -E 'let x = 1; in x + 1'

Output: 2

Get derivation

nix-instantiate '<nixpkgs>' -A hello

Output: /nix/store/...-hello.drv

$
# CAVEATS

Newer nix commands (nix eval) supersede some uses. Strict evaluation required for full values. Part of legacy Nix CLI.

# HISTORY

nix-instantiate is one of the original Nix commands, part of the core tooling since **Nix** was first released in **2003**.

# SEE ALSO

nix-build(1), nix-store(1), nix-env(1)

# INSTALL
copy
$ dnf: sudo dnf install nix
copy
$ pacman: sudo pacman -S nix
copy
$ apk: sudo apk add nix
copy
$ zypper: sudo zypper install nix
copy
$ nix: nix profile install nixpkgs#nix
copy

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid