Nix By Examples

REPL

console

The nix repl command opens a REPL which can be handy to debug or play with the language. As with most REPLs, CTRL-c allows you to cancel a command, and CTRL-d allows you to quit the REPL.

$ nix repl

The nix language is a function language. If you've done some OCaml before, it should not be too hard to ramp up. I recommend to read the Nix page on learnXinYminutes, although it would be nice to have explanations on this page.

Welcome to Nix 2.9.1. Type :? for help.

nix-repl>

repl

The nix language is a function language. If you've done some OCaml before, it should not be too hard to ramp up. I recommend to read the Nix page on learnXinYminutes, although it would be nice to have explanations on this page.

nix-repl> 1 + 1
2

nix-repl> (import ./flake.nix)
{ description = "A very basic flake"; outputs = «lambda @ /some/path/hello/flake.nix:4:13»; }
next: let ... in ...