move preBuildHook defaulting to globals.cc

This commit is contained in:
Jude Taylor 2015-10-21 14:39:08 -07:00
parent 2dc8e19a17
commit 76f3ba42fd
2 changed files with 5 additions and 7 deletions

View file

@ -59,12 +59,10 @@
/* chroot-like behavior from Apple's sandbox */ /* chroot-like behavior from Apple's sandbox */
#if __APPLE__ #if __APPLE__
#define SANDBOX_ENABLED 1 #define SANDBOX_ENABLED 1
#define DARWIN_PREBUILD 1
#define DEFAULT_ALLOWED_IMPURE_PREFIXES "/System/Library /usr/lib /dev /bin/sh" #define DEFAULT_ALLOWED_IMPURE_PREFIXES "/System/Library /usr/lib /dev /bin/sh"
#else #else
#define SANDBOX_ENABLED 0 #define SANDBOX_ENABLED 0
#define DEFAULT_ALLOWED_IMPURE_PREFIXES "/bin" "/usr/bin" #define DEFAULT_ALLOWED_IMPURE_PREFIXES "/bin" "/usr/bin"
#define DARWIN_PREBUILD 0
#endif #endif
#if CHROOT_ENABLED #if CHROOT_ENABLED
@ -2047,11 +2045,6 @@ void DerivationGoal::startBuilder()
} }
} }
#if DARWIN_PREBUILD
if (settings.preBuildHook == "")
settings.preBuildHook = settings.nixLibexecDir + "/nix/resolve-system-dependencies.pl";
#endif
if (settings.preBuildHook != "") { if (settings.preBuildHook != "") {
printMsg(lvlChatty, format("executing pre-build hook %1%") printMsg(lvlChatty, format("executing pre-build hook %1%")
% settings.preBuildHook); % settings.preBuildHook);

View file

@ -77,6 +77,11 @@ void Settings::processEnvironment()
nixLibexecDir = canonPath(getEnv("NIX_LIBEXEC_DIR", NIX_LIBEXEC_DIR)); nixLibexecDir = canonPath(getEnv("NIX_LIBEXEC_DIR", NIX_LIBEXEC_DIR));
nixBinDir = canonPath(getEnv("NIX_BIN_DIR", NIX_BIN_DIR)); nixBinDir = canonPath(getEnv("NIX_BIN_DIR", NIX_BIN_DIR));
nixDaemonSocketFile = canonPath(nixStateDir + DEFAULT_SOCKET_PATH); nixDaemonSocketFile = canonPath(nixStateDir + DEFAULT_SOCKET_PATH);
// should be set with the other config options, but depends on nixLibexecDir
#ifdef __APPLE__
preBuildHook = nixLibexecDir + "/nix/resolve-system-dependencies.pl";
#endif
} }