forked from lix-project/lix
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.
This commit is contained in:
parent
b005e63ccf
commit
6f0c6e20e0
|
@ -23,6 +23,5 @@ derivation {
|
||||||
# network traffic, so don't do that.
|
# network traffic, so don't do that.
|
||||||
preferLocalBuild = true;
|
preferLocalBuild = true;
|
||||||
|
|
||||||
# Don't build in a chroot because Nix's dependencies may not be there.
|
inherit chrootDeps;
|
||||||
__noChroot = true;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ let
|
||||||
fromEnv = var: def:
|
fromEnv = var: def:
|
||||||
let val = builtins.getEnv var; in
|
let val = builtins.getEnv var; in
|
||||||
if val != "" then val else def;
|
if val != "" then val else def;
|
||||||
in {
|
in rec {
|
||||||
perl = "@perl@";
|
perl = "@perl@";
|
||||||
shell = "@bash@";
|
shell = "@bash@";
|
||||||
coreutils = "@coreutils@";
|
coreutils = "@coreutils@";
|
||||||
|
@ -14,4 +14,14 @@ in {
|
||||||
tr = "@tr@";
|
tr = "@tr@";
|
||||||
curl = "@curl@";
|
curl = "@curl@";
|
||||||
nixBinDir = fromEnv "NIX_BIN_DIR" "@bindir@";
|
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
|
||||||
|
[ ];
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ let
|
||||||
'' + (if executable then "${coreutils}/chmod +x $out" else ""));
|
'' + (if executable then "${coreutils}/chmod +x $out" else ""));
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
derivation {
|
derivation {
|
||||||
name = baseNameOf (toString url);
|
name = baseNameOf (toString url);
|
||||||
builder = shell;
|
builder = shell;
|
||||||
|
@ -26,15 +26,12 @@ derivation {
|
||||||
outputHash = if outputHash != "" then outputHash else
|
outputHash = if outputHash != "" then outputHash else
|
||||||
if sha256 != "" then sha256 else if sha1 != "" then sha1 else md5;
|
if sha256 != "" then sha256 else if sha1 != "" then sha1 else md5;
|
||||||
outputHashMode = if executable then "recursive" else "flat";
|
outputHashMode = if executable then "recursive" else "flat";
|
||||||
|
|
||||||
inherit system url;
|
inherit system url;
|
||||||
|
|
||||||
# No need to double the amount of network traffic
|
# No need to double the amount of network traffic
|
||||||
preferLocalBuild = true;
|
preferLocalBuild = true;
|
||||||
|
|
||||||
# Don't build in a chroot because Nix's dependencies may not be there.
|
|
||||||
__noChroot = true;
|
|
||||||
|
|
||||||
impureEnvVars = [
|
impureEnvVars = [
|
||||||
# We borrow these environment variables from the caller to allow
|
# We borrow these environment variables from the caller to allow
|
||||||
# easy proxy configuration. This is impure, but a fixed-output
|
# easy proxy configuration. This is impure, but a fixed-output
|
||||||
|
@ -42,4 +39,6 @@ derivation {
|
||||||
# by definition pure.
|
# by definition pure.
|
||||||
"http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy"
|
"http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
inherit chrootDeps;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,9 +41,8 @@ derivation {
|
||||||
args = [ "-e" builder ];
|
args = [ "-e" builder ];
|
||||||
inherit storePath hashAlgo compressionType;
|
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
|
# Remote machines may not have ${nixBinDir} or ${coreutils} in the same prefixes
|
||||||
preferLocalBuild = true;
|
preferLocalBuild = true;
|
||||||
|
|
||||||
|
inherit chrootDeps;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,5 @@ derivation {
|
||||||
# No point in doing this remotely.
|
# No point in doing this remotely.
|
||||||
preferLocalBuild = true;
|
preferLocalBuild = true;
|
||||||
|
|
||||||
# Don't build in a chroot because Nix's dependencies may not be there.
|
inherit chrootDeps;
|
||||||
__noChroot = true;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1507,12 +1507,15 @@ void EvalState::createBaseEnv()
|
||||||
mkInt(v, time(0));
|
mkInt(v, time(0));
|
||||||
addConstant("__currentTime", v);
|
addConstant("__currentTime", v);
|
||||||
|
|
||||||
mkString(v, settings.thisSystem.c_str());
|
mkString(v, settings.thisSystem);
|
||||||
addConstant("__currentSystem", v);
|
addConstant("__currentSystem", v);
|
||||||
|
|
||||||
mkString(v, nixVersion.c_str());
|
mkString(v, nixVersion);
|
||||||
addConstant("__nixVersion", v);
|
addConstant("__nixVersion", v);
|
||||||
|
|
||||||
|
mkString(v, settings.nixStore);
|
||||||
|
addConstant("__storeDir", v);
|
||||||
|
|
||||||
/* Language version. This should be increased every time a new
|
/* Language version. This should be increased every time a new
|
||||||
language feature gets added. It's not necessary to increase it
|
language feature gets added. It's not necessary to increase it
|
||||||
when primops get added, because you can just use `builtins ?
|
when primops get added, because you can just use `builtins ?
|
||||||
|
|
Loading…
Reference in a new issue