diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-03-24 11:15:45 +0100 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-03-24 11:15:45 +0100 |
commit | 6f0c6e20e03bc82fcf0d2198cf81fa2cf25c2f6c (patch) | |
tree | 0037f8a7f72bb2c0fd5cb89e8c37c03d1c8c8ebf /corepkgs | |
parent | b005e63ccf387add426aa9941ab9f5770307fe33 (diff) |
Don't rely on __noChroot for corepkgs
This doesn't work anymore if the "strict" chroot mode is
enabled. Instead, add Nix's store path as a dependency. This ensures
that its closure is present in the chroot.
Diffstat (limited to 'corepkgs')
-rw-r--r-- | corepkgs/buildenv.nix | 3 | ||||
-rw-r--r-- | corepkgs/config.nix.in | 12 | ||||
-rw-r--r-- | corepkgs/fetchurl.nix | 9 | ||||
-rw-r--r-- | corepkgs/nar.nix | 5 | ||||
-rw-r--r-- | corepkgs/unpack-channel.nix | 3 |
5 files changed, 19 insertions, 13 deletions
diff --git a/corepkgs/buildenv.nix b/corepkgs/buildenv.nix index c52a0ea93..5bf7b4e56 100644 --- a/corepkgs/buildenv.nix +++ b/corepkgs/buildenv.nix @@ -23,6 +23,5 @@ derivation { # network traffic, so don't do that. preferLocalBuild = true; - # Don't build in a chroot because Nix's dependencies may not be there. - __noChroot = true; + inherit chrootDeps; } diff --git a/corepkgs/config.nix.in b/corepkgs/config.nix.in index a5ec83b9e..8918f4ddd 100644 --- a/corepkgs/config.nix.in +++ b/corepkgs/config.nix.in @@ -2,7 +2,7 @@ let fromEnv = var: def: let val = builtins.getEnv var; in if val != "" then val else def; -in { +in rec { perl = "@perl@"; shell = "@bash@"; coreutils = "@coreutils@"; @@ -14,4 +14,14 @@ in { tr = "@tr@"; curl = "@curl@"; nixBinDir = fromEnv "NIX_BIN_DIR" "@bindir@"; + nixPrefix = "@prefix@"; + + # If Nix is installed in the Nix store, then automatically add it as + # a dependency to the core packages. This ensures that they work + # properly in a chroot. + chrootDeps = + if dirOf nixPrefix == builtins.storeDir then + [ (builtins.storePath nixPrefix) ] + else + [ ]; } diff --git a/corepkgs/fetchurl.nix b/corepkgs/fetchurl.nix index 4faedb140..1ce88593c 100644 --- a/corepkgs/fetchurl.nix +++ b/corepkgs/fetchurl.nix @@ -14,7 +14,7 @@ let '' + (if executable then "${coreutils}/chmod +x $out" else "")); in - + derivation { name = baseNameOf (toString url); builder = shell; @@ -26,15 +26,12 @@ derivation { outputHash = if outputHash != "" then outputHash else if sha256 != "" then sha256 else if sha1 != "" then sha1 else md5; outputHashMode = if executable then "recursive" else "flat"; - + inherit system url; # No need to double the amount of network traffic preferLocalBuild = true; - # Don't build in a chroot because Nix's dependencies may not be there. - __noChroot = true; - impureEnvVars = [ # We borrow these environment variables from the caller to allow # easy proxy configuration. This is impure, but a fixed-output @@ -42,4 +39,6 @@ derivation { # by definition pure. "http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy" ]; + + inherit chrootDeps; } diff --git a/corepkgs/nar.nix b/corepkgs/nar.nix index 04be17fb0..61b3fc677 100644 --- a/corepkgs/nar.nix +++ b/corepkgs/nar.nix @@ -41,9 +41,8 @@ derivation { args = [ "-e" builder ]; inherit storePath hashAlgo compressionType; - # Don't build in a chroot because Nix's dependencies may not be there. - __noChroot = true; - # Remote machines may not have ${nixBinDir} or ${coreutils} in the same prefixes preferLocalBuild = true; + + inherit chrootDeps; } diff --git a/corepkgs/unpack-channel.nix b/corepkgs/unpack-channel.nix index f7c521035..9445532de 100644 --- a/corepkgs/unpack-channel.nix +++ b/corepkgs/unpack-channel.nix @@ -37,6 +37,5 @@ derivation { # No point in doing this remotely. preferLocalBuild = true; - # Don't build in a chroot because Nix's dependencies may not be there. - __noChroot = true; + inherit chrootDeps; } |