Improve setting the default chroot dirs

This commit is contained in:
Eelco Dolstra 2015-03-24 11:57:46 +01:00
parent fd89f97be9
commit 5114a07d95
3 changed files with 7 additions and 9 deletions

View file

@ -93,13 +93,6 @@ let
--sysconfdir=/etc --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; enableParallelBuilding = true;
makeFlags = "profiledir=$(out)/etc/profile.d"; makeFlags = "profiledir=$(out)/etc/profile.d";

View file

@ -1784,9 +1784,14 @@ void DerivationGoal::startBuilder()
} }
if (useChroot) { if (useChroot) {
string defaultChrootDirs;
if (isInStore(BASH_PATH))
defaultChrootDirs = "/bin/sh=" BASH_PATH;
/* Allow a user-configurable set of directories from the /* Allow a user-configurable set of directories from the
host file system. */ host file system. */
PathSet dirs = tokenizeString<StringSet>(settings.get("build-chroot-dirs", string(DEFAULT_CHROOT_DIRS))); PathSet dirs = tokenizeString<StringSet>(settings.get("build-chroot-dirs", defaultChrootDirs));
PathSet dirs2 = tokenizeString<StringSet>(settings.get("build-extra-chroot-dirs", string(""))); PathSet dirs2 = tokenizeString<StringSet>(settings.get("build-extra-chroot-dirs", string("")));
dirs.insert(dirs2.begin(), dirs2.end()); dirs.insert(dirs2.begin(), dirs2.end());

View file

@ -22,7 +22,7 @@ libstore_CXXFLAGS = \
-DNIX_CONF_DIR=\"$(sysconfdir)/nix\" \ -DNIX_CONF_DIR=\"$(sysconfdir)/nix\" \
-DNIX_LIBEXEC_DIR=\"$(libexecdir)\" \ -DNIX_LIBEXEC_DIR=\"$(libexecdir)\" \
-DNIX_BIN_DIR=\"$(bindir)\" \ -DNIX_BIN_DIR=\"$(bindir)\" \
-DDEFAULT_CHROOT_DIRS="\"$(DEFAULT_CHROOT_DIRS)\"" -DBASH_PATH="\"$(bash)\""
$(d)/local-store.cc: $(d)/schema.sql.hh $(d)/local-store.cc: $(d)/schema.sql.hh