From 883191c91d618940f316b2c25afd8a0d2169114b Mon Sep 17 00:00:00 2001 From: Niels Egberts Date: Sat, 10 Jul 2021 14:48:15 +0100 Subject: [PATCH] Output of declare -xp is no longer visible in the repl Instead nix-store --read-log can be used to see the environment variables. --- pills/07-working-derivation.xml | 5 +++++ pills/07/read-log.xml | 18 ++++++++++++++++++ pills/07/simple-derivation.xml | 23 +---------------------- 3 files changed, 24 insertions(+), 22 deletions(-) create mode 100644 pills/07/read-log.xml diff --git a/pills/07-working-derivation.xml b/pills/07-working-derivation.xml index ad7726d..ded4fda 100644 --- a/pills/07-working-derivation.xml +++ b/pills/07-working-derivation.xml @@ -114,6 +114,11 @@
The builder environment + + We can use nix-store --read-log to see the logs our + builder produced: + + Let's inspect those environment variables printed during the build process. diff --git a/pills/07/read-log.xml b/pills/07/read-log.xml new file mode 100644 index 0000000..2124383 --- /dev/null +++ b/pills/07/read-log.xml @@ -0,0 +1,18 @@ +$ 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" diff --git a/pills/07/simple-derivation.xml b/pills/07/simple-derivation.xml index e82127f..49f3599 100644 --- a/pills/07/simple-derivation.xml +++ b/pills/07/simple-derivation.xml @@ -1,27 +1,6 @@ nix-repl> d = derivation { name = "foo"; builder = "${bash}/bin/bash"; args = [ ./builder.sh ]; system = builtins.currentSystem; } nix-repl> :b d -these derivations will be built: - /nix/store/i76pr1cz0za3i9r6xq518bqqvd2raspw-foo.drv -building '/nix/store/i76pr1cz0za3i9r6xq518bqqvd2raspw-foo.drv'... -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" -warning: you did not specify '--add-root'; the result might be removed by the garbage collector -/nix/store/gczb4qrag22harvv693wwnflqy7lx5pb-foo +[1 built, 0.0 MiB DL] this derivation produced the following outputs: out -> /nix/store/gczb4qrag22harvv693wwnflqy7lx5pb-foo