aboutsummaryrefslogtreecommitdiff
path: root/doc/manual/src/expressions/generic-builder.md
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-07-31 15:43:25 +0200
committerEelco Dolstra <edolstra@gmail.com>2020-07-31 15:43:25 +0200
commit1d0a7b54fa330b041a720932ee4e05dcad1d2d5c (patch)
tree48627a3530e4d6d58c612864b2e99afb11a0a902 /doc/manual/src/expressions/generic-builder.md
parent0c94c176446bd9e9cb8c7e16fb7c6d88bb4e9a20 (diff)
Enable syntax highlighting
Diffstat (limited to 'doc/manual/src/expressions/generic-builder.md')
-rw-r--r--doc/manual/src/expressions/generic-builder.md34
1 files changed, 20 insertions, 14 deletions
diff --git a/doc/manual/src/expressions/generic-builder.md b/doc/manual/src/expressions/generic-builder.md
index 43275dbf7..cf26b5f82 100644
--- a/doc/manual/src/expressions/generic-builder.md
+++ b/doc/manual/src/expressions/generic-builder.md
@@ -3,12 +3,14 @@
Recall that the [build script for GNU Hello](build-script.md) looked
something like this:
- PATH=$perl/bin:$PATH
- tar xvfz $src
- cd hello-*
- ./configure --prefix=$out
- make
- make install
+```bash
+PATH=$perl/bin:$PATH
+tar xvfz $src
+cd hello-*
+./configure --prefix=$out
+make
+make install
+```
The builders for almost all Unix packages look like this — set up some
environment variables, unpack the sources, configure, build, and
@@ -16,11 +18,13 @@ install. For this reason the standard environment provides some Bash
functions that automate the build process. Here is what a builder using
the generic build facilities looks like:
- buildInputs="$perl" ①
-
- source $stdenv/setup ②
-
- genericBuild ③
+```bash
+buildInputs="$perl" ①
+
+source $stdenv/setup ②
+
+genericBuild ③
+```
Here is what each line means:
@@ -45,15 +49,17 @@ Here is what each line means:
Discerning readers will note that the `buildInputs` could just as well
have been set in the Nix expression, like this:
-```
+```nix
buildInputs = [ perl ];
```
The `perl` attribute can then be removed, and the builder becomes even
shorter:
- source $stdenv/setup
- genericBuild
+```bash
+source $stdenv/setup
+genericBuild
+```
In fact, `mkDerivation` provides a default builder that looks exactly
like that, so it is actually possible to omit the builder for Hello