diff --git a/etc/default.nix b/etc/default.nix index 88d4d39e21e..6ecfedf7897 100644 --- a/etc/default.nix +++ b/etc/default.nix @@ -132,16 +132,22 @@ import ../helpers/make-etc.nix { # other paths in the store, we need the closure of /bin/sh # in `build-chroot-dirs' - otherwise any builder that uses # /bin/sh won't work. - refs = pkgs.writeReferencesToFile binsh; + binshDeps = pkgs.writeReferencesToFile binsh; + + # Likewise, if chroots are turned on, we need Nix's own + # closure in the chroot. Otherwise nix-channel and nix-env + # won't work because the dependencies of its builders (like + # coreutils and Perl) aren't visible. Sigh. + nixDeps = pkgs.writeReferencesToFile config.environment.nix; in pkgs.runCommand "nix.conf" {} '' - binshDeps=$(for i in $(cat ${refs}); do if test -d $i; then echo $i; fi; done) + extraPaths=$(for i in $(cat ${binshDeps} ${nixDeps}); do if test -d $i; then echo $i; fi; done) cat > $out <