From 5114a07d9578e06c66862270a3d624fc0944f33a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 24 Mar 2015 11:57:46 +0100 Subject: [PATCH] Improve setting the default chroot dirs --- release.nix | 7 ------- src/libstore/build.cc | 7 ++++++- src/libstore/local.mk | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/release.nix b/release.nix index 47ba1c1c3..de539958c 100644 --- a/release.nix +++ b/release.nix @@ -93,13 +93,6 @@ let --sysconfdir=/etc ''; - # Provide a default value for the ‘build-chroot-dirs’ setting - # that includes /bin/sh pointing to bash. - preHook = lib.optionalString stdenv.isLinux - '' - export DEFAULT_CHROOT_DIRS="/bin/sh=${stdenv.shell}" - ''; - enableParallelBuilding = true; makeFlags = "profiledir=$(out)/etc/profile.d"; diff --git a/src/libstore/build.cc b/src/libstore/build.cc index 1c510fa7d..90bcccd24 100644 --- a/src/libstore/build.cc +++ b/src/libstore/build.cc @@ -1784,9 +1784,14 @@ void DerivationGoal::startBuilder() } if (useChroot) { + + string defaultChrootDirs; + if (isInStore(BASH_PATH)) + defaultChrootDirs = "/bin/sh=" BASH_PATH; + /* Allow a user-configurable set of directories from the host file system. */ - PathSet dirs = tokenizeString(settings.get("build-chroot-dirs", string(DEFAULT_CHROOT_DIRS))); + PathSet dirs = tokenizeString(settings.get("build-chroot-dirs", defaultChrootDirs)); PathSet dirs2 = tokenizeString(settings.get("build-extra-chroot-dirs", string(""))); dirs.insert(dirs2.begin(), dirs2.end()); diff --git a/src/libstore/local.mk b/src/libstore/local.mk index 7c99fd77a..78b4d0fd4 100644 --- a/src/libstore/local.mk +++ b/src/libstore/local.mk @@ -22,7 +22,7 @@ libstore_CXXFLAGS = \ -DNIX_CONF_DIR=\"$(sysconfdir)/nix\" \ -DNIX_LIBEXEC_DIR=\"$(libexecdir)\" \ -DNIX_BIN_DIR=\"$(bindir)\" \ - -DDEFAULT_CHROOT_DIRS="\"$(DEFAULT_CHROOT_DIRS)\"" + -DBASH_PATH="\"$(bash)\"" $(d)/local-store.cc: $(d)/schema.sql.hh