Fix code sections with highlighting, which pandoc missed

This commit is contained in:
Noam Yorav-Raphael 2024-04-02 19:48:20 +03:00 committed by Jan Tojnar
parent f0099a3e28
commit 38c9f8c47c
5 changed files with 243 additions and 11 deletions

View file

@ -58,7 +58,11 @@ Important: Never change `/nix/store` manually. If you do, then it will no longer
Next in the installation, we encounter the concept of the [profile](https://nixos.org/manual/nix/stable/package-management/profiles.html):
\<screen\>creating /home/nix/.nix-profile installing \'nix-2.1.3\' building path(s) \`/nix/store/a7p1w3z2h8pl00ywvw6icr3g5l9vm5r7-\<emphasis role=\"strong\"\>user-environment\</emphasis\>\' created 7 symlinks in user environment\</screen\>
<pre><code class="hljs">creating /home/nix/.nix-profile
installing 'nix-2.1.3'
building path(s) `/nix/store/a7p1w3z2h8pl00ywvw6icr3g5l9vm5r7-<b>user-environment</b>'
created 7 symlinks in user environment
</code></pre>
A profile in Nix is a general and convenient concept for realizing rollbacks. Profiles are used to compose components that are spread among multiple paths under a new unified path. Not only that, but profiles are made up of multiple \"generations\": they are versioned. Whenever you change a profile, a new generation is created.
@ -66,7 +70,13 @@ Generations can be switched and rolled back atomically, which makes them conveni
Let\'s take a closer look at our profile:
\<screen\>\$ ls -l \~/.nix-profile/ bin -\> /nix/store/ig31y9gfpp8pf3szdd7d4sf29zr7igbr-\<emphasis role=\"strong\"\>nix-2.1.3\</emphasis\>/bin \[\...\] manifest.nix -\> /nix/store/q8b5238akq07lj9gfb3qb5ycq4dxxiwm-\<emphasis role=\"strong\"\>env-manifest.nix\</emphasis\> \[\...\] share -\> /nix/store/ig31y9gfpp8pf3szdd7d4sf29zr7igbr-\<emphasis role=\"strong\"\>nix-2.1.3\</emphasis\>/share\</screen\>
<pre><code class="hljs">$ ls -l ~/.nix-profile/
bin -> /nix/store/ig31y9gfpp8pf3szdd7d4sf29zr7igbr-<b>nix-2.1.3</b>/bin
[...]
manifest.nix -> /nix/store/q8b5238akq07lj9gfb3qb5ycq4dxxiwm-<b>env-manifest.nix</b>
[...]
share -> /nix/store/ig31y9gfpp8pf3szdd7d4sf29zr7igbr-<b>nix-2.1.3</b>/share
</code></pre>
That nix-2.1.3 derivation in the Nix store is Nix itself, with binaries and libraries. The process of \"installing\" the derivation in the profile basically reproduces the hierarchy of the nix-2.1.3 store derivation in the profile by means of symbolic links.

View file

@ -55,7 +55,29 @@ Note: If your version of nix doesn't have `nix derivation show`, use `nix show-d
</div>
\<screen xmlns=\"http://docbook.org/ns/docbook\"\>\<prompt\>\$ \</prompt\>\<userinput\>nix derivation show /nix/store/z3hhlxbckx4g3n9sw91nnvlkjvyw754p-\<emphasis\>myname.drv\</emphasis\>\</userinput\> \<computeroutput\>{ \"/nix/store/z3hhlxbckx4g3n9sw91nnvlkjvyw754p-myname.drv\": { \"outputs\": { \"out\": { \"path\": \"/nix/store/40s0qmrfb45vlh6610rk29ym318dswdr-myname\" } }, \"inputSrcs\": \[\], \"inputDrvs\": {}, \"platform\": \"mysystem\", \"builder\": \"mybuilder\", \"args\": \[\], \"env\": { \"builder\": \"mybuilder\", \"name\": \"myname\", \"out\": \"/nix/store/40s0qmrfb45vlh6610rk29ym318dswdr-myname\", \"system\": \"mysystem\" } } }\</computeroutput\>\</screen\>
```
$ nix derivation show /nix/store/z3hhlxbckx4g3n9sw91nnvlkjvyw754p-myname.drv
{
"/nix/store/z3hhlxbckx4g3n9sw91nnvlkjvyw754p-myname.drv": {
"outputs": {
"out": {
"path": "/nix/store/40s0qmrfb45vlh6610rk29ym318dswdr-myname"
}
},
"inputSrcs": [],
"inputDrvs": {},
"platform": "mysystem",
"builder": "mybuilder",
"args": [],
"env": {
"builder": "mybuilder",
"name": "myname",
"out": "/nix/store/40s0qmrfb45vlh6610rk29ym318dswdr-myname",
"system": "mysystem"
}
}
}
```
Ok, we can see there\'s an out path, but it does not exist yet. We never told Nix to build it, but we know beforehand where the build output will be. Why?
@ -201,7 +223,33 @@ Obvious note: every time we change the derivation, a new hash is created.
Let\'s examine the new `.drv` now that we referred to another derivation:
\<screen xmlns=\"http://docbook.org/ns/docbook\"\>\<prompt\>\$ \</prompt\>\<userinput\>nix derivation show /nix/store/qyfrcd53wmc0v22ymhhd5r6sz5xmdc8a-\<emphasis\>myname.drv\</emphasis\>\</userinput\> \<computeroutput\>{ \"/nix/store/qyfrcd53wmc0v22ymhhd5r6sz5xmdc8a-myname.drv\": { \"outputs\": { \"out\": { \"path\": \"/nix/store/ly2k1vswbfmswr33hw0kf0ccilrpisnk-myname\" } }, \"inputSrcs\": \[\], \"inputDrvs\": { \"/nix/store/hixdnzz2wp75x1jy65cysq06yl74vx7q-coreutils-8.29.drv\": \[ \"out\" \] }, \"platform\": \"x86_64-linux\", \"builder\": \"/nix/store/qrxs7sabhqcr3j9ai0j0cp58zfnny0jz-coreutils-8.29/bin/true\", \"args\": \[\], \"env\": { \"builder\": \"/nix/store/qrxs7sabhqcr3j9ai0j0cp58zfnny0jz-coreutils-8.29/bin/true\", \"name\": \"myname\", \"out\": \"/nix/store/ly2k1vswbfmswr33hw0kf0ccilrpisnk-myname\", \"system\": \"x86_64-linux\" } } }\</computeroutput\>\</screen\>
```
$ nix derivation show /nix/store/qyfrcd53wmc0v22ymhhd5r6sz5xmdc8a-myname.drv
{
"/nix/store/qyfrcd53wmc0v22ymhhd5r6sz5xmdc8a-myname.drv": {
"outputs": {
"out": {
"path": "/nix/store/ly2k1vswbfmswr33hw0kf0ccilrpisnk-myname"
}
},
"inputSrcs": [],
"inputDrvs": {
"/nix/store/hixdnzz2wp75x1jy65cysq06yl74vx7q-coreutils-8.29.drv": [
"out"
]
},
"platform": "x86_64-linux",
"builder": "/nix/store/qrxs7sabhqcr3j9ai0j0cp58zfnny0jz-coreutils-8.29/bin/true",
"args": [],
"env": {
"builder": "/nix/store/qrxs7sabhqcr3j9ai0j0cp58zfnny0jz-coreutils-8.29/bin/true",
"name": "myname",
"out": "/nix/store/ly2k1vswbfmswr33hw0kf0ccilrpisnk-myname",
"system": "x86_64-linux"
}
}
}
```
Aha! Nix added a dependency to our myname.drv, it\'s the coreutils.drv. Before doing our build, Nix should build the coreutils.drv. But since coreutils is already in our nix store, no build is needed, it\'s already there with out path `/nix/store/qrxs7sabhqcr3j9ai0j0cp58zfnny0jz-coreutils-8.29`.

View file

@ -29,13 +29,54 @@ What we have to do is create something in the path `$out`, be it a file or a dir
In addition, we print out the environment variables during the build process. We cannot use env for this, because env is part of coreutils and we don\'t have a dependency to it yet. We only have bash for now.
Like for coreutils in the previous pill, we get a blessed bash for free from our magic nixpkgs stuff: \<screen xmlns=\"http://docbook.org/ns/docbook\"\>\<prompt\>nix-repl\> \</prompt\>\<userinput\>:l &lt;nixpkgs\>\</userinput\> \<computeroutput\>Added 3950 variables.\</computeroutput\> \<prompt\>nix-repl\> \</prompt\>\<userinput\>\"\${bash}\"\</userinput\> \<computeroutput\>\"/nix/store/ihmkc7z2wqk3bbipfnlh0yjrlfkkgnv6-\<emphasis\>bash-4.2-p45\</emphasis\>\"\</computeroutput\> \</screen\> So with the usual trick, we can refer to bin/bash and create our derivation: \<screen xmlns=\"http://docbook.org/ns/docbook\"\>\<prompt\>nix-repl\> \</prompt\>\<userinput\>d = derivation { name = \"foo\"; builder = \"\${bash}/bin/bash\"; args = \[ ./builder.sh \]; system = builtins.currentSystem; }\</userinput\> \<prompt\>nix-repl\> \</prompt\>\<userinput\>:b d\</userinput\> \<computeroutput\>\[1 built, 0.0 MiB DL\] this derivation produced the following outputs: out -\> /nix/store/gczb4qrag22harvv693wwnflqy7lx5pb-\<emphasis\>foo\</emphasis\>\</computeroutput\>\</screen\> We did it! The contents of `/nix/store/w024zci0x1hh1wj6gjq0jagkc1sgrf5r-foo` is really foo. We\'ve built our first derivation.
Like for coreutils in the previous pill, we get a blessed bash for free from our magic nixpkgs stuff:
```
nix-repl> :l <nixpkgs>
Added 3950 variables.
nix-repl> "${bash}"
"/nix/store/ihmkc7z2wqk3bbipfnlh0yjrlfkkgnv6-bash-4.2-p45"
```
So with the usual trick, we can refer to bin/bash and create our derivation:
```
nix-repl> d = derivation { name = "foo"; builder = "${bash}/bin/bash"; args = [ ./builder.sh ]; system = builtins.currentSystem; }
nix-repl> :b d
[1 built, 0.0 MiB DL]
this derivation produced the following outputs:
out -> /nix/store/gczb4qrag22harvv693wwnflqy7lx5pb-foo
```
We did it! The contents of `/nix/store/w024zci0x1hh1wj6gjq0jagkc1sgrf5r-foo` is really foo. We\'ve built our first derivation.
Note that we used `./builder.sh` and not `"./builder.sh"`. This way, it is parsed as a path, and Nix performs some magic which we will cover later. Try using the string version and you will find that it cannot find `builder.sh`. This is because it tries to find it relative to the temporary build directory.
## The builder environment
We can use `nix-store --read-log` to see the logs our builder produced: \<screen xmlns=\"http://docbook.org/ns/docbook\"\>\<prompt\>\$ \</prompt\>\<userinput\>nix-store \--read-log /nix/store/gczb4qrag22harvv693wwnflqy7lx5pb-\<emphasis\>foo\</emphasis\>\</userinput\> \<computeroutput\>declare -x HOME=\"/homeless-shelter\" declare -x NIX_BUILD_CORES=\"4\" declare -x NIX_BUILD_TOP=\"/tmp/nix-build-foo.drv-0\" declare -x NIX_LOG_FD=\"2\" declare -x NIX_STORE=\"/nix/store\" declare -x OLDPWD declare -x PATH=\"/path-not-set\" declare -x PWD=\"/tmp/nix-build-foo.drv-0\" declare -x SHLVL=\"1\" declare -x TEMP=\"/tmp/nix-build-foo.drv-0\" declare -x TEMPDIR=\"/tmp/nix-build-foo.drv-0\" declare -x TMP=\"/tmp/nix-build-foo.drv-0\" declare -x TMPDIR=\"/tmp/nix-build-foo.drv-0\" declare -x builder=\"/nix/store/q1g0rl8zfmz7r371fp5p42p4acmv297d-bash-4.4-p19/bin/bash\" declare -x name=\"foo\" declare -x out=\"/nix/store/gczb4qrag22harvv693wwnflqy7lx5pb-foo\" declare -x system=\"x86_64-linux\"\</computeroutput\>\</screen\>
We can use `nix-store --read-log` to see the logs our builder produced:
```
$ nix-store --read-log /nix/store/gczb4qrag22harvv693wwnflqy7lx5pb-foo
declare -x HOME="/homeless-shelter"
declare -x NIX_BUILD_CORES="4"
declare -x NIX_BUILD_TOP="/tmp/nix-build-foo.drv-0"
declare -x NIX_LOG_FD="2"
declare -x NIX_STORE="/nix/store"
declare -x OLDPWD
declare -x PATH="/path-not-set"
declare -x PWD="/tmp/nix-build-foo.drv-0"
declare -x SHLVL="1"
declare -x TEMP="/tmp/nix-build-foo.drv-0"
declare -x TEMPDIR="/tmp/nix-build-foo.drv-0"
declare -x TMP="/tmp/nix-build-foo.drv-0"
declare -x TMPDIR="/tmp/nix-build-foo.drv-0"
declare -x builder="/nix/store/q1g0rl8zfmz7r371fp5p42p4acmv297d-bash-4.4-p19/bin/bash"
declare -x name="foo"
declare -x out="/nix/store/gczb4qrag22harvv693wwnflqy7lx5pb-foo"
declare -x system="x86_64-linux"
```
Let\'s inspect those environment variables printed during the build process.
@ -55,7 +96,41 @@ In terms of autotools, `$out` will be the `--prefix` path. Yes, not the make `DE
## The .drv contents
We added something else to the derivation this time: the args attribute. Let\'s see how this changed the .drv compared to the previous pill: \<screen xmlns=\"http://docbook.org/ns/docbook\"\>\<prompt\>\$ \</prompt\>\<userinput\>nix derivation show /nix/store/i76pr1cz0za3i9r6xq518bqqvd2raspw-\<emphasis\>foo.drv\</emphasis\>\</userinput\> \<computeroutput\>{ \"/nix/store/i76pr1cz0za3i9r6xq518bqqvd2raspw-foo.drv\": { \"outputs\": { \"out\": { \"path\": \"/nix/store/gczb4qrag22harvv693wwnflqy7lx5pb-foo\" } }, \"inputSrcs\": \[ \"/nix/store/lb0n38r2b20r8rl1k45a7s4pj6ny22f7-builder.sh\" \], \"inputDrvs\": { \"/nix/store/hcgwbx42mcxr7ksnv0i1fg7kw6jvxshb-bash-4.4-p19.drv\": \[ \"out\" \] }, \"platform\": \"x86_64-linux\", \"builder\": \"/nix/store/q1g0rl8zfmz7r371fp5p42p4acmv297d-bash-4.4-p19/bin/bash\", \"args\": \[ \"/nix/store/lb0n38r2b20r8rl1k45a7s4pj6ny22f7-builder.sh\" \], \"env\": { \"builder\": \"/nix/store/q1g0rl8zfmz7r371fp5p42p4acmv297d-bash-4.4-p19/bin/bash\", \"name\": \"foo\", \"out\": \"/nix/store/gczb4qrag22harvv693wwnflqy7lx5pb-foo\", \"system\": \"x86_64-linux\" } } }\</computeroutput\>\</screen\> Much like the usual .drv, except that there\'s a list of arguments in there passed to the builder (bash) with `builder.sh`... In the nix store..? Nix automatically copies files or directories needed for the build into the store to ensure that they are not changed during the build process and that the deployment is stateless and independent of the building machine. `builder.sh` is not only in the arguments passed to the builder, it\'s also in the input derivations.
We added something else to the derivation this time: the args attribute. Let\'s see how this changed the .drv compared to the previous pill:
```
$ nix derivation show /nix/store/i76pr1cz0za3i9r6xq518bqqvd2raspw-foo.drv
{
"/nix/store/i76pr1cz0za3i9r6xq518bqqvd2raspw-foo.drv": {
"outputs": {
"out": {
"path": "/nix/store/gczb4qrag22harvv693wwnflqy7lx5pb-foo"
}
},
"inputSrcs": [
"/nix/store/lb0n38r2b20r8rl1k45a7s4pj6ny22f7-builder.sh"
],
"inputDrvs": {
"/nix/store/hcgwbx42mcxr7ksnv0i1fg7kw6jvxshb-bash-4.4-p19.drv": [
"out"
]
},
"platform": "x86_64-linux",
"builder": "/nix/store/q1g0rl8zfmz7r371fp5p42p4acmv297d-bash-4.4-p19/bin/bash",
"args": [
"/nix/store/lb0n38r2b20r8rl1k45a7s4pj6ny22f7-builder.sh"
],
"env": {
"builder": "/nix/store/q1g0rl8zfmz7r371fp5p42p4acmv297d-bash-4.4-p19/bin/bash",
"name": "foo",
"out": "/nix/store/gczb4qrag22harvv693wwnflqy7lx5pb-foo",
"system": "x86_64-linux"
}
}
}
```
Much like the usual .drv, except that there\'s a list of arguments in there passed to the builder (bash) with `builder.sh`... In the nix store..? Nix automatically copies files or directories needed for the build into the store to ensure that they are not changed during the build process and that the deployment is stateless and independent of the building machine. `builder.sh` is not only in the arguments passed to the builder, it\'s also in the input derivations.
Given that `builder.sh` is a plain file, it has no .drv associated with it. The store path is computed based on the filename and on the hash of its contents. Store paths are covered in detail in [a later pill](18-nix-store-paths.md).
@ -73,7 +148,18 @@ And its `simple_builder.sh`:
mkdir $out
gcc -o $out/simple $src
Don\'t worry too much about where those variables come from yet; let\'s write the derivation and build it: \<screen xmlns=\"http://docbook.org/ns/docbook\"\>\<prompt\>nix-repl\> \</prompt\>\<userinput\>:l &lt;nixpkgs\>\</userinput\> \<prompt\>nix-repl\> \</prompt\>\<userinput\>simple = derivation { name = \"simple\"; builder = \"\${bash}/bin/bash\"; args = \[ ./simple_builder.sh \]; gcc = gcc; coreutils = coreutils; src = ./simple.c; system = builtins.currentSystem; }\</userinput\> \<prompt\>nix-repl\> \</prompt\>\<userinput\>:b simple\</userinput\> \<computeroutput\>this derivation produced the following outputs: out -\> /nix/store/ni66p4jfqksbmsl616llx3fbs1d232d4-simple \</computeroutput\>\</screen\> Now you can run `/nix/store/ni66p4jfqksbmsl616llx3fbs1d232d4-simple/simple` in your shell.
Don\'t worry too much about where those variables come from yet; let\'s write the derivation and build it:
```
nix-repl> :l <nixpkgs>
nix-repl> simple = derivation { name = "simple"; builder = "${bash}/bin/bash"; args = [ ./simple_builder.sh ]; gcc = gcc; coreutils = coreutils; src = ./simple.c; system = builtins.currentSystem; }
nix-repl> :b simple
this derivation produced the following outputs:
out -> /nix/store/ni66p4jfqksbmsl616llx3fbs1d232d4-simple
```
Now you can run `/nix/store/ni66p4jfqksbmsl616llx3fbs1d232d4-simple/simple` in your shell.
## Explanation

View file

@ -20,7 +20,31 @@ I remind you, the simplest derivation you can write has a `name`, a `builder` an
Now inspect the .drv to see where is `./myfile` being stored:
\<screen xmlns=\"http://docbook.org/ns/docbook\"\>\<prompt\>\$ \</prompt\>\<userinput\>nix derivation show /nix/store/y4h73bmrc9ii5bxg6i7ck6hsf5gqv8ck-\<emphasis\>foo.drv\</emphasis\>\</userinput\> \<computeroutput\>{ \"/nix/store/y4h73bmrc9ii5bxg6i7ck6hsf5gqv8ck-foo.drv\": { \"outputs\": { \"out\": { \"path\": \"/nix/store/hs0yi5n5nw6micqhy8l1igkbhqdkzqa1-foo\" } }, \"inputSrcs\": \[ \"/nix/store/xv2iccirbrvklck36f1g7vldn5v58vck-myfile\" \], \"inputDrvs\": {}, \"platform\": \"x86_64-linux\", \"builder\": \"/nix/store/xv2iccirbrvklck36f1g7vldn5v58vck-myfile\", \"args\": \[\], \"env\": { \"builder\": \"/nix/store/xv2iccirbrvklck36f1g7vldn5v58vck-myfile\", \"name\": \"foo\", \"out\": \"/nix/store/hs0yi5n5nw6micqhy8l1igkbhqdkzqa1-foo\", \"system\": \"x86_64-linux\" } } }\</computeroutput\>\</screen\>
```
$ nix derivation show /nix/store/y4h73bmrc9ii5bxg6i7ck6hsf5gqv8ck-foo.drv
{
"/nix/store/y4h73bmrc9ii5bxg6i7ck6hsf5gqv8ck-foo.drv": {
"outputs": {
"out": {
"path": "/nix/store/hs0yi5n5nw6micqhy8l1igkbhqdkzqa1-foo"
}
},
"inputSrcs": [
"/nix/store/xv2iccirbrvklck36f1g7vldn5v58vck-myfile"
],
"inputDrvs": {},
"platform": "x86_64-linux",
"builder": "/nix/store/xv2iccirbrvklck36f1g7vldn5v58vck-myfile",
"args": [],
"env": {
"builder": "/nix/store/xv2iccirbrvklck36f1g7vldn5v58vck-myfile",
"name": "foo",
"out": "/nix/store/hs0yi5n5nw6micqhy8l1igkbhqdkzqa1-foo",
"system": "x86_64-linux"
}
}
}
```
Great, how did nix decide to use `xv2iccirbrvklck36f1g7vldn5v58vck` ? Keep looking at the nix comments.
@ -96,7 +120,20 @@ Let\'s say our builder should create a file whose contents is `mycontent`:
Inspect the .drv and see that it also stored the fact that it\'s a fixed-output derivation with sha256 algorithm, compared to the previous examples:
\<screen xmlns=\"http://docbook.org/ns/docbook\"\>\<prompt\>\$ \</prompt\>\<userinput\>nix derivation show /nix/store/ymsf5zcqr9wlkkqdjwhqllgwa97rff5i-\<emphasis\>bar.drv\</emphasis\>\</userinput\> \<computeroutput\>{ \"/nix/store/ymsf5zcqr9wlkkqdjwhqllgwa97rff5i-bar.drv\": { \"outputs\": { \"out\": { \"path\": \"/nix/store/a00d5f71k0vp5a6klkls0mvr1f7sx6ch-bar\", \"hashAlgo\": \"sha256\", \"hash\": \"f3f3c4763037e059b4d834eaf68595bbc02ba19f6d2a500dce06d124e2cd99bb\" } }, \<emphasis\>\[\...\]\</emphasis\> }\</computeroutput\>\</screen\>
```
$ nix derivation show /nix/store/ymsf5zcqr9wlkkqdjwhqllgwa97rff5i-bar.drv
{
"/nix/store/ymsf5zcqr9wlkkqdjwhqllgwa97rff5i-bar.drv": {
"outputs": {
"out": {
"path": "/nix/store/a00d5f71k0vp5a6klkls0mvr1f7sx6ch-bar",
"hashAlgo": "sha256",
"hash": "f3f3c4763037e059b4d834eaf68595bbc02ba19f6d2a500dce06d124e2cd99bb"
}
},
[...]
}
```
It doesn\'t matter which input derivations are being used, the final out path must only depend on the declared hash.

View file

@ -118,7 +118,58 @@ It\'s what we did in [Pill 10](10-developing-with-nix-shell.md) to make the deri
To get a clear understanding of the environment variables, look at the .drv of the hello derivation:
\<screen xmlns=\"http://docbook.org/ns/docbook\"\>\<prompt\>\$ \</prompt\>\<userinput\>nix derivation show \$(nix-instantiate hello.nix)\</userinput\> \<computeroutput\>warning: you did not specify \'\--add-root\'; the result might be removed by the garbage collector { \"/nix/store/abwj50lycl0m515yblnrvwyydlhhqvj2-hello.drv\": { \"outputs\": { \"out\": { \"path\": \"/nix/store/6y0mzdarm5qxfafvn2zm9nr01d1j0a72-hello\" } }, \"inputSrcs\": \[ \"/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh\", \"/nix/store/svc70mmzrlgq42m9acs0prsmci7ksh6h-hello-2.10.tar.gz\" \], \"inputDrvs\": { \"/nix/store/hcgwbx42mcxr7ksnv0i1fg7kw6jvxshb-bash-4.4-p19.drv\": \[ \"out\" \], \"/nix/store/sfxh3ybqh97cgl4s59nrpi78kgcc8f3d-stdenv-linux.drv\": \[ \"out\" \] }, \"platform\": \"x86_64-linux\", \"builder\": \"/nix/store/q1g0rl8zfmz7r371fp5p42p4acmv297d-bash-4.4-p19/bin/bash\", \"args\": \[ \"-e\", \"/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh\" \], \"env\": { \"buildInputs\": \"\", \"builder\": \"/nix/store/q1g0rl8zfmz7r371fp5p42p4acmv297d-bash-4.4-p19/bin/bash\", \"configureFlags\": \"\", \"depsBuildBuild\": \"\", \"depsBuildBuildPropagated\": \"\", \"depsBuildTarget\": \"\", \"depsBuildTargetPropagated\": \"\", \"depsHostBuild\": \"\", \"depsHostBuildPropagated\": \"\", \"depsTargetTarget\": \"\", \"depsTargetTargetPropagated\": \"\", \"name\": \"hello\", \"nativeBuildInputs\": \"\", \"out\": \"/nix/store/6y0mzdarm5qxfafvn2zm9nr01d1j0a72-hello\", \"propagatedBuildInputs\": \"\", \"propagatedNativeBuildInputs\": \"\", \"src\": \"/nix/store/svc70mmzrlgq42m9acs0prsmci7ksh6h-hello-2.10.tar.gz\", \"stdenv\": \"/nix/store/6kz2vbh98s2r1pfshidkzhiy2s2qdw0a-stdenv-linux\", \"system\": \"x86_64-linux\" } } }\</computeroutput\>\</screen\>
```
$ nix derivation show $(nix-instantiate hello.nix)
warning: you did not specify '--add-root'; the result might be removed by the garbage collector
{
"/nix/store/abwj50lycl0m515yblnrvwyydlhhqvj2-hello.drv": {
"outputs": {
"out": {
"path": "/nix/store/6y0mzdarm5qxfafvn2zm9nr01d1j0a72-hello"
}
},
"inputSrcs": [
"/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh",
"/nix/store/svc70mmzrlgq42m9acs0prsmci7ksh6h-hello-2.10.tar.gz"
],
"inputDrvs": {
"/nix/store/hcgwbx42mcxr7ksnv0i1fg7kw6jvxshb-bash-4.4-p19.drv": [
"out"
],
"/nix/store/sfxh3ybqh97cgl4s59nrpi78kgcc8f3d-stdenv-linux.drv": [
"out"
]
},
"platform": "x86_64-linux",
"builder": "/nix/store/q1g0rl8zfmz7r371fp5p42p4acmv297d-bash-4.4-p19/bin/bash",
"args": [
"-e",
"/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh"
],
"env": {
"buildInputs": "",
"builder": "/nix/store/q1g0rl8zfmz7r371fp5p42p4acmv297d-bash-4.4-p19/bin/bash",
"configureFlags": "",
"depsBuildBuild": "",
"depsBuildBuildPropagated": "",
"depsBuildTarget": "",
"depsBuildTargetPropagated": "",
"depsHostBuild": "",
"depsHostBuildPropagated": "",
"depsTargetTarget": "",
"depsTargetTargetPropagated": "",
"name": "hello",
"nativeBuildInputs": "",
"out": "/nix/store/6y0mzdarm5qxfafvn2zm9nr01d1j0a72-hello",
"propagatedBuildInputs": "",
"propagatedNativeBuildInputs": "",
"src": "/nix/store/svc70mmzrlgq42m9acs0prsmci7ksh6h-hello-2.10.tar.gz",
"stdenv": "/nix/store/6kz2vbh98s2r1pfshidkzhiy2s2qdw0a-stdenv-linux",
"system": "x86_64-linux"
}
}
}
```
It\'s so short I decided to paste it entirely above. The builder is bash, with `-e default-builder.sh` arguments. Then you can see the `src` and `stdenv` environment variables.