From bb45092f72d173a7754f7e4a6457d44c748a893b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 4 Aug 2014 17:07:28 +0200 Subject: [PATCH] Make chroot builds easier to set up By default, we now include /bin/sh as a bind-mount of bash. --- release.nix | 8 ++++++++ src/libstore/globals.cc | 3 +++ 2 files changed, 11 insertions(+) diff --git a/release.nix b/release.nix index 1f91e23b5..c43925792 100644 --- a/release.nix +++ b/release.nix @@ -93,6 +93,14 @@ 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 ( + let sh = stdenv.shell; in + '' + NIX_CFLAGS_COMPILE+=" -DDEFAULT_CHROOT_DIRS=\"/bin/sh=${sh}:$(tr '\n' ':' < ${writeReferencesToFile sh})\"" + ''); + enableParallelBuilding = true; makeFlags = "profiledir=$(out)/etc/profile.d"; diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc index e9fe0beca..77f25005b 100644 --- a/src/libstore/globals.cc +++ b/src/libstore/globals.cc @@ -48,6 +48,9 @@ Settings::Settings() useSubstitutes = true; buildUsersGroup = getuid() == 0 ? "nixbld" : ""; useChroot = false; +#ifdef DEFAULT_CHROOT_DIRS + dirsInChroot = tokenizeString(DEFAULT_CHROOT_DIRS, ":"); +#endif useSshSubstituter = true; impersonateLinux26 = false; keepLog = true;