From c155a3f46e44a08b1a2cca0ab5e3da9c39c685a1 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 15 Dec 2008 23:54:10 +0000 Subject: [PATCH] * When doing chroot builds, the `build-chroot-dirs' option should include the closure of /bin/sh. Otherwise all builders that call /bin/sh will fail when using the new chroot implementation, which only bind-mounts the inputs of a build rather than the whole Nix store. svn path=/nixos/trunk/; revision=13640 --- default.nix | 2 +- etc/default.nix | 31 ++++++++++++++++++++++--------- system/activate-configuration.sh | 2 +- system/system.nix | 12 ++++++++---- 4 files changed, 32 insertions(+), 15 deletions(-) diff --git a/default.nix b/default.nix index 3923cb9592b7..46f2d265216f 100644 --- a/default.nix +++ b/default.nix @@ -1,6 +1,6 @@ let - fromEnv = name : default : + fromEnv = name: default: let env = builtins.getEnv name; in if env == "" then default else env; configuration = import (fromEnv "NIXOS_CONFIG" /etc/nixos/configuration.nix); diff --git a/etc/default.nix b/etc/default.nix index 448fa993d73b..c4cb68d94150 100644 --- a/etc/default.nix +++ b/etc/default.nix @@ -1,5 +1,5 @@ { config, pkgs, upstartJobs, systemPath, wrapperDir -, defaultShell, extraEtc, nixEnvVars, modulesTree, nssModulesPath +, defaultShell, extraEtc, nixEnvVars, modulesTree, nssModulesPath, binsh }: let @@ -123,14 +123,27 @@ import ../helpers/make-etc.nix { } { # Nix configuration. - source = pkgs.writeText "nix.conf" '' - # WARNING: this file is generated. - build-users-group = nixbld - build-max-jobs = ${toString (config.nix.maxJobs)} - build-use-chroot = ${if config.nix.useChroot then "true" else "false"} - build-chroot-dirs = /dev /dev/pts /proc /bin - ${config.nix.extraOptions} - ''; + source = + let + # Tricky: if we're using a chroot for builds, then we need + # /bin/sh in the chroot (our own compromise to purity). + # However, since /bin/sh is a symlink to some path in the + # Nix store, which furthermore has runtime dependencies on + # 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; + in + pkgs.runCommand "nix.conf" {} '' + cat > $out <