From b0023d2ade69dbd95a328c85c507c1f4a4bbf67e Mon Sep 17 00:00:00 2001 From: Valentin Gagarin Date: Mon, 22 Aug 2022 18:54:31 +0200 Subject: [PATCH] add subsections to modes of running examples reorder to have the REPL first (it's fewer steps) --- source/tutorials/nix-language.md | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/source/tutorials/nix-language.md b/source/tutorials/nix-language.md index 027c414..ea74e2f 100644 --- a/source/tutorials/nix-language.md +++ b/source/tutorials/nix-language.md @@ -85,6 +85,24 @@ The following example is a Nix expression adding two numbers: 3 +#### Interactive evaluation + +Use `nix repl` to evaluate Nix expressions interactively (by typing them on the command line): + +```console +nix repl +``` + + Welcome to Nix 2.5.1. Type :? for help. + +```console +nix-repl> 1 + 2 +``` + + 3 + +#### Evaluating Nix files + Use `nix-instantiate --eval` to evaluate the expression in a Nix file. ```console @@ -107,20 +125,6 @@ nix-instantiate --eval 3 ::: -Use `nix repl` to evaluate Nix expressions interactively (by typing them on the command line): - -```console -nix repl -``` - - Welcome to Nix 2.5.1. Type :? for help. - -```console -nix-repl> 1 + 2 -``` - - 3 - ## Reading the Nix language without fear You will quickly encounter Nix language expressions that may look very complicated.