top-level: Introduce `buildPackages` for resolving build-time deps
[N.B., this package also applies to the commits that follow it in the same
PR.]
In most cases, buildPackages = pkgs so things work just as before. For
cross compiling, however, buildPackages is resolved as the previous
bootstrapping stage. This allows us to avoid the mkDerivation hacks cross
compiling currently uses today.
To avoid a massive refactor, callPackage will splice together both package
sets. Again to avoid churn, it uses the old `nativeDrv` vs `crossDrv` to do
so. So now, whether cross compiling or not, packages with get a `nativeDrv`
and `crossDrv`---in the non-cross-compiling case they are simply the same
derivation. This is good because it reduces the divergence between the
cross and non-cross dataflow. See `pkgs/top-level/splice.nix` for a comment
along the lines of the preceding paragraph, and the code that does this
splicing.
Also, `forceNativeDrv` is replaced with `forceNativePackages`. The latter
resolves `pkgs` unless the host platform is different from the build
platform, in which case it resolves to `buildPackages`. Note that the
target platform is not important here---it will not prevent
`forcedNativePackages` from resolving to `pkgs`.
--------
Temporarily, we make preserve some dubious decisions in the name of preserving
hashes:
Most importantly, we don't distinguish between "host" and "target" in the
autoconf sense. This leads to the proliferation of *Cross derivations
currently used. What we ought to is resolve native deps of the cross "build
packages" (build = host != target) package set against the "vanilla
packages" (build = host = target) package set. Instead, "build packages"
uses itself, with (informally) target != build in all cases.
This is wrong because it violates the "sliding window" principle of
bootstrapping stages that shifting the platform triple of one stage to the
left coincides with the next stage's platform triple. Only because we don't
explicitly distinguish between "host" and "target" does it appear that the
"sliding window" principle is preserved--indeed it is over the reductionary
"platform double" of just "build" and "host/target".
Additionally, we build libc, libgcc, etc in the same stage as the compilers
themselves, which is wrong because they are used at runtime, not build
time. Fixing this is somewhat subtle, and the solution and problem will be
better explained in the commit that does fix it.
Commits after this will solve both these issues, at the expense of breaking
cross hashes. Native hashes won't be broken, thankfully.
--------
Did the temporary ugliness pan out? Of the packages that currently build in
`release-cross.nix`, the only ones that have their hash changed are
`*.gcc.crossDrv` and `bootstrapTools.*.coreutilsMinimal`. In both cases I
think it doesn't matter.
1. GCC when doing a `build = host = target = foreign` build (maximally
cross), still defines environment variables like `CPATH`[1] with
packages. This seems assuredly wrong because whether gcc dynamically
links those, or the programs built by gcc dynamically link those---I
have no idea which case is reality---they should be foreign. Therefore,
in all likelihood, I just made the gcc less broken.
2. Coreutils (ab)used the old cross-compiling infrastructure to depend on
a native version of itself. When coreutils was overwritten to be built
with fewer features, the native version it used would also be
overwritten because the binding was tight. Now it uses the much looser
`BuildPackages.coreutils` which is just fine as a richer build dep
doesn't cause any problems and avoids a rebuild.
So, in conclusion I'd say the conservatism payed off. Onward to actually
raking the muck in the next PR!
[1]: https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html
2016-12-18 07:51:18 +00:00
|
|
|
# The `splicedPackages' package set, and its use by `callPackage`
|
|
|
|
#
|
|
|
|
# The `buildPackages` pkg set is a new concept, and the vast majority package
|
|
|
|
# expression (the other *.nix files) are not designed with it in mind. This
|
|
|
|
# presents us with a problem with how to get the right version (build-time vs
|
|
|
|
# run-time) of a package to a consumer that isn't used to thinking so cleverly.
|
|
|
|
#
|
|
|
|
# The solution is to splice the package sets together as we do below, so every
|
2023-08-05 21:01:26 +00:00
|
|
|
# `callPackage`d expression in fact gets both versions. Each derivation (and
|
|
|
|
# each derivation's outputs) consists of the run-time version, augmented with
|
|
|
|
# a `__spliced.buildHost` field for the build-time version, and
|
|
|
|
# `__spliced.hostTarget` field for the run-time version.
|
top-level: Introduce `buildPackages` for resolving build-time deps
[N.B., this package also applies to the commits that follow it in the same
PR.]
In most cases, buildPackages = pkgs so things work just as before. For
cross compiling, however, buildPackages is resolved as the previous
bootstrapping stage. This allows us to avoid the mkDerivation hacks cross
compiling currently uses today.
To avoid a massive refactor, callPackage will splice together both package
sets. Again to avoid churn, it uses the old `nativeDrv` vs `crossDrv` to do
so. So now, whether cross compiling or not, packages with get a `nativeDrv`
and `crossDrv`---in the non-cross-compiling case they are simply the same
derivation. This is good because it reduces the divergence between the
cross and non-cross dataflow. See `pkgs/top-level/splice.nix` for a comment
along the lines of the preceding paragraph, and the code that does this
splicing.
Also, `forceNativeDrv` is replaced with `forceNativePackages`. The latter
resolves `pkgs` unless the host platform is different from the build
platform, in which case it resolves to `buildPackages`. Note that the
target platform is not important here---it will not prevent
`forcedNativePackages` from resolving to `pkgs`.
--------
Temporarily, we make preserve some dubious decisions in the name of preserving
hashes:
Most importantly, we don't distinguish between "host" and "target" in the
autoconf sense. This leads to the proliferation of *Cross derivations
currently used. What we ought to is resolve native deps of the cross "build
packages" (build = host != target) package set against the "vanilla
packages" (build = host = target) package set. Instead, "build packages"
uses itself, with (informally) target != build in all cases.
This is wrong because it violates the "sliding window" principle of
bootstrapping stages that shifting the platform triple of one stage to the
left coincides with the next stage's platform triple. Only because we don't
explicitly distinguish between "host" and "target" does it appear that the
"sliding window" principle is preserved--indeed it is over the reductionary
"platform double" of just "build" and "host/target".
Additionally, we build libc, libgcc, etc in the same stage as the compilers
themselves, which is wrong because they are used at runtime, not build
time. Fixing this is somewhat subtle, and the solution and problem will be
better explained in the commit that does fix it.
Commits after this will solve both these issues, at the expense of breaking
cross hashes. Native hashes won't be broken, thankfully.
--------
Did the temporary ugliness pan out? Of the packages that currently build in
`release-cross.nix`, the only ones that have their hash changed are
`*.gcc.crossDrv` and `bootstrapTools.*.coreutilsMinimal`. In both cases I
think it doesn't matter.
1. GCC when doing a `build = host = target = foreign` build (maximally
cross), still defines environment variables like `CPATH`[1] with
packages. This seems assuredly wrong because whether gcc dynamically
links those, or the programs built by gcc dynamically link those---I
have no idea which case is reality---they should be foreign. Therefore,
in all likelihood, I just made the gcc less broken.
2. Coreutils (ab)used the old cross-compiling infrastructure to depend on
a native version of itself. When coreutils was overwritten to be built
with fewer features, the native version it used would also be
overwritten because the binding was tight. Now it uses the much looser
`BuildPackages.coreutils` which is just fine as a richer build dep
doesn't cause any problems and avoids a rebuild.
So, in conclusion I'd say the conservatism payed off. Onward to actually
raking the muck in the next PR!
[1]: https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html
2016-12-18 07:51:18 +00:00
|
|
|
#
|
2017-01-15 23:03:59 +00:00
|
|
|
# For performance reasons, rather than uniformally splice in all cases, we only
|
|
|
|
# do so when `pkgs` and `buildPackages` are distinct. The `actuallySplice`
|
|
|
|
# parameter there the boolean value of that equality check.
|
|
|
|
lib: pkgs: actuallySplice:
|
top-level: Introduce `buildPackages` for resolving build-time deps
[N.B., this package also applies to the commits that follow it in the same
PR.]
In most cases, buildPackages = pkgs so things work just as before. For
cross compiling, however, buildPackages is resolved as the previous
bootstrapping stage. This allows us to avoid the mkDerivation hacks cross
compiling currently uses today.
To avoid a massive refactor, callPackage will splice together both package
sets. Again to avoid churn, it uses the old `nativeDrv` vs `crossDrv` to do
so. So now, whether cross compiling or not, packages with get a `nativeDrv`
and `crossDrv`---in the non-cross-compiling case they are simply the same
derivation. This is good because it reduces the divergence between the
cross and non-cross dataflow. See `pkgs/top-level/splice.nix` for a comment
along the lines of the preceding paragraph, and the code that does this
splicing.
Also, `forceNativeDrv` is replaced with `forceNativePackages`. The latter
resolves `pkgs` unless the host platform is different from the build
platform, in which case it resolves to `buildPackages`. Note that the
target platform is not important here---it will not prevent
`forcedNativePackages` from resolving to `pkgs`.
--------
Temporarily, we make preserve some dubious decisions in the name of preserving
hashes:
Most importantly, we don't distinguish between "host" and "target" in the
autoconf sense. This leads to the proliferation of *Cross derivations
currently used. What we ought to is resolve native deps of the cross "build
packages" (build = host != target) package set against the "vanilla
packages" (build = host = target) package set. Instead, "build packages"
uses itself, with (informally) target != build in all cases.
This is wrong because it violates the "sliding window" principle of
bootstrapping stages that shifting the platform triple of one stage to the
left coincides with the next stage's platform triple. Only because we don't
explicitly distinguish between "host" and "target" does it appear that the
"sliding window" principle is preserved--indeed it is over the reductionary
"platform double" of just "build" and "host/target".
Additionally, we build libc, libgcc, etc in the same stage as the compilers
themselves, which is wrong because they are used at runtime, not build
time. Fixing this is somewhat subtle, and the solution and problem will be
better explained in the commit that does fix it.
Commits after this will solve both these issues, at the expense of breaking
cross hashes. Native hashes won't be broken, thankfully.
--------
Did the temporary ugliness pan out? Of the packages that currently build in
`release-cross.nix`, the only ones that have their hash changed are
`*.gcc.crossDrv` and `bootstrapTools.*.coreutilsMinimal`. In both cases I
think it doesn't matter.
1. GCC when doing a `build = host = target = foreign` build (maximally
cross), still defines environment variables like `CPATH`[1] with
packages. This seems assuredly wrong because whether gcc dynamically
links those, or the programs built by gcc dynamically link those---I
have no idea which case is reality---they should be foreign. Therefore,
in all likelihood, I just made the gcc less broken.
2. Coreutils (ab)used the old cross-compiling infrastructure to depend on
a native version of itself. When coreutils was overwritten to be built
with fewer features, the native version it used would also be
overwritten because the binding was tight. Now it uses the much looser
`BuildPackages.coreutils` which is just fine as a richer build dep
doesn't cause any problems and avoids a rebuild.
So, in conclusion I'd say the conservatism payed off. Onward to actually
raking the muck in the next PR!
[1]: https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html
2016-12-18 07:51:18 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
|
2022-12-24 13:55:22 +00:00
|
|
|
spliceReal =
|
|
|
|
{ pkgsBuildBuild
|
|
|
|
, pkgsBuildHost
|
|
|
|
, pkgsBuildTarget
|
|
|
|
, pkgsHostHost
|
|
|
|
, pkgsHostTarget
|
|
|
|
, pkgsTargetTarget
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
mash =
|
|
|
|
# Other pkgs sets
|
|
|
|
pkgsBuildBuild // pkgsBuildTarget // pkgsHostHost // pkgsTargetTarget
|
|
|
|
# The same pkgs sets one probably intends
|
|
|
|
// pkgsBuildHost // pkgsHostTarget;
|
|
|
|
merge = name: {
|
|
|
|
inherit name;
|
|
|
|
value =
|
|
|
|
let
|
|
|
|
defaultValue = mash.${name};
|
|
|
|
# `or {}` is for the non-derivation attsert splicing case, where `{}` is the identity.
|
|
|
|
valueBuildBuild = pkgsBuildBuild.${name} or { };
|
|
|
|
valueBuildHost = pkgsBuildHost.${name} or { };
|
|
|
|
valueBuildTarget = pkgsBuildTarget.${name} or { };
|
|
|
|
valueHostHost = pkgsHostHost.${name} or { };
|
|
|
|
valueHostTarget = pkgsHostTarget.${name} or { };
|
|
|
|
valueTargetTarget = pkgsTargetTarget.${name} or { };
|
|
|
|
augmentedValue = defaultValue
|
|
|
|
// {
|
|
|
|
__spliced =
|
|
|
|
(lib.optionalAttrs (pkgsBuildBuild ? ${name}) { buildBuild = valueBuildBuild; })
|
|
|
|
// (lib.optionalAttrs (pkgsBuildHost ? ${name}) { buildHost = valueBuildHost; })
|
|
|
|
// (lib.optionalAttrs (pkgsBuildTarget ? ${name}) { buildTarget = valueBuildTarget; })
|
|
|
|
// (lib.optionalAttrs (pkgsHostHost ? ${name}) { hostHost = valueHostHost; })
|
|
|
|
// (lib.optionalAttrs (pkgsHostTarget ? ${name}) { hostTarget = valueHostTarget; })
|
|
|
|
// (lib.optionalAttrs (pkgsTargetTarget ? ${name}) {
|
|
|
|
targetTarget = valueTargetTarget;
|
|
|
|
});
|
|
|
|
};
|
|
|
|
# Get the set of outputs of a derivation. If one derivation fails to
|
|
|
|
# evaluate we don't want to diverge the entire splice, so we fall back
|
|
|
|
# on {}
|
|
|
|
tryGetOutputs = value0:
|
|
|
|
let
|
|
|
|
inherit (builtins.tryEval value0) success value;
|
|
|
|
in
|
|
|
|
getOutputs (lib.optionalAttrs success value);
|
|
|
|
getOutputs = value: lib.genAttrs
|
|
|
|
(value.outputs or (lib.optional (value ? out) "out"))
|
|
|
|
(output: value.${output});
|
|
|
|
in
|
|
|
|
# The derivation along with its outputs, which we recur
|
|
|
|
# on to splice them together.
|
|
|
|
if lib.isDerivation defaultValue then augmentedValue // spliceReal {
|
|
|
|
pkgsBuildBuild = tryGetOutputs valueBuildBuild;
|
|
|
|
pkgsBuildHost = tryGetOutputs valueBuildHost;
|
|
|
|
pkgsBuildTarget = tryGetOutputs valueBuildTarget;
|
|
|
|
pkgsHostHost = tryGetOutputs valueHostHost;
|
|
|
|
pkgsHostTarget = getOutputs valueHostTarget;
|
|
|
|
pkgsTargetTarget = tryGetOutputs valueTargetTarget;
|
|
|
|
# Just recur on plain attrsets
|
|
|
|
} else if lib.isAttrs defaultValue then
|
|
|
|
spliceReal
|
|
|
|
{
|
|
|
|
pkgsBuildBuild = valueBuildBuild;
|
|
|
|
pkgsBuildHost = valueBuildHost;
|
|
|
|
pkgsBuildTarget = valueBuildTarget;
|
|
|
|
pkgsHostHost = valueHostHost;
|
|
|
|
pkgsHostTarget = valueHostTarget;
|
|
|
|
pkgsTargetTarget = valueTargetTarget;
|
|
|
|
# Don't be fancy about non-derivations. But we could have used used
|
|
|
|
# `__functor__` for functions instead.
|
|
|
|
} else defaultValue;
|
|
|
|
};
|
|
|
|
in
|
|
|
|
lib.listToAttrs (map merge (lib.attrNames mash));
|
top-level: Introduce `buildPackages` for resolving build-time deps
[N.B., this package also applies to the commits that follow it in the same
PR.]
In most cases, buildPackages = pkgs so things work just as before. For
cross compiling, however, buildPackages is resolved as the previous
bootstrapping stage. This allows us to avoid the mkDerivation hacks cross
compiling currently uses today.
To avoid a massive refactor, callPackage will splice together both package
sets. Again to avoid churn, it uses the old `nativeDrv` vs `crossDrv` to do
so. So now, whether cross compiling or not, packages with get a `nativeDrv`
and `crossDrv`---in the non-cross-compiling case they are simply the same
derivation. This is good because it reduces the divergence between the
cross and non-cross dataflow. See `pkgs/top-level/splice.nix` for a comment
along the lines of the preceding paragraph, and the code that does this
splicing.
Also, `forceNativeDrv` is replaced with `forceNativePackages`. The latter
resolves `pkgs` unless the host platform is different from the build
platform, in which case it resolves to `buildPackages`. Note that the
target platform is not important here---it will not prevent
`forcedNativePackages` from resolving to `pkgs`.
--------
Temporarily, we make preserve some dubious decisions in the name of preserving
hashes:
Most importantly, we don't distinguish between "host" and "target" in the
autoconf sense. This leads to the proliferation of *Cross derivations
currently used. What we ought to is resolve native deps of the cross "build
packages" (build = host != target) package set against the "vanilla
packages" (build = host = target) package set. Instead, "build packages"
uses itself, with (informally) target != build in all cases.
This is wrong because it violates the "sliding window" principle of
bootstrapping stages that shifting the platform triple of one stage to the
left coincides with the next stage's platform triple. Only because we don't
explicitly distinguish between "host" and "target" does it appear that the
"sliding window" principle is preserved--indeed it is over the reductionary
"platform double" of just "build" and "host/target".
Additionally, we build libc, libgcc, etc in the same stage as the compilers
themselves, which is wrong because they are used at runtime, not build
time. Fixing this is somewhat subtle, and the solution and problem will be
better explained in the commit that does fix it.
Commits after this will solve both these issues, at the expense of breaking
cross hashes. Native hashes won't be broken, thankfully.
--------
Did the temporary ugliness pan out? Of the packages that currently build in
`release-cross.nix`, the only ones that have their hash changed are
`*.gcc.crossDrv` and `bootstrapTools.*.coreutilsMinimal`. In both cases I
think it doesn't matter.
1. GCC when doing a `build = host = target = foreign` build (maximally
cross), still defines environment variables like `CPATH`[1] with
packages. This seems assuredly wrong because whether gcc dynamically
links those, or the programs built by gcc dynamically link those---I
have no idea which case is reality---they should be foreign. Therefore,
in all likelihood, I just made the gcc less broken.
2. Coreutils (ab)used the old cross-compiling infrastructure to depend on
a native version of itself. When coreutils was overwritten to be built
with fewer features, the native version it used would also be
overwritten because the binding was tight. Now it uses the much looser
`BuildPackages.coreutils` which is just fine as a richer build dep
doesn't cause any problems and avoids a rebuild.
So, in conclusion I'd say the conservatism payed off. Onward to actually
raking the muck in the next PR!
[1]: https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html
2016-12-18 07:51:18 +00:00
|
|
|
|
2022-12-24 13:55:22 +00:00
|
|
|
splicePackages =
|
|
|
|
{ pkgsBuildBuild
|
|
|
|
, pkgsBuildHost
|
|
|
|
, pkgsBuildTarget
|
|
|
|
, pkgsHostHost
|
|
|
|
, pkgsHostTarget
|
|
|
|
, pkgsTargetTarget
|
|
|
|
} @ args:
|
2018-07-06 00:19:07 +00:00
|
|
|
if actuallySplice then spliceReal args else pkgsHostTarget;
|
|
|
|
|
2022-12-24 13:55:22 +00:00
|
|
|
splicedPackages = splicePackages
|
|
|
|
{
|
|
|
|
inherit (pkgs)
|
|
|
|
pkgsBuildBuild pkgsBuildHost pkgsBuildTarget
|
|
|
|
pkgsHostHost pkgsHostTarget
|
|
|
|
pkgsTargetTarget
|
|
|
|
;
|
|
|
|
} // {
|
2018-07-06 00:19:07 +00:00
|
|
|
# These should never be spliced under any circumstances
|
2019-03-13 17:34:38 +00:00
|
|
|
inherit (pkgs)
|
|
|
|
pkgsBuildBuild pkgsBuildHost pkgsBuildTarget
|
|
|
|
pkgsHostHost pkgsHostTarget
|
|
|
|
pkgsTargetTarget
|
|
|
|
buildPackages pkgs targetPackages
|
|
|
|
;
|
2018-07-06 00:19:07 +00:00
|
|
|
};
|
top-level: Introduce `buildPackages` for resolving build-time deps
[N.B., this package also applies to the commits that follow it in the same
PR.]
In most cases, buildPackages = pkgs so things work just as before. For
cross compiling, however, buildPackages is resolved as the previous
bootstrapping stage. This allows us to avoid the mkDerivation hacks cross
compiling currently uses today.
To avoid a massive refactor, callPackage will splice together both package
sets. Again to avoid churn, it uses the old `nativeDrv` vs `crossDrv` to do
so. So now, whether cross compiling or not, packages with get a `nativeDrv`
and `crossDrv`---in the non-cross-compiling case they are simply the same
derivation. This is good because it reduces the divergence between the
cross and non-cross dataflow. See `pkgs/top-level/splice.nix` for a comment
along the lines of the preceding paragraph, and the code that does this
splicing.
Also, `forceNativeDrv` is replaced with `forceNativePackages`. The latter
resolves `pkgs` unless the host platform is different from the build
platform, in which case it resolves to `buildPackages`. Note that the
target platform is not important here---it will not prevent
`forcedNativePackages` from resolving to `pkgs`.
--------
Temporarily, we make preserve some dubious decisions in the name of preserving
hashes:
Most importantly, we don't distinguish between "host" and "target" in the
autoconf sense. This leads to the proliferation of *Cross derivations
currently used. What we ought to is resolve native deps of the cross "build
packages" (build = host != target) package set against the "vanilla
packages" (build = host = target) package set. Instead, "build packages"
uses itself, with (informally) target != build in all cases.
This is wrong because it violates the "sliding window" principle of
bootstrapping stages that shifting the platform triple of one stage to the
left coincides with the next stage's platform triple. Only because we don't
explicitly distinguish between "host" and "target" does it appear that the
"sliding window" principle is preserved--indeed it is over the reductionary
"platform double" of just "build" and "host/target".
Additionally, we build libc, libgcc, etc in the same stage as the compilers
themselves, which is wrong because they are used at runtime, not build
time. Fixing this is somewhat subtle, and the solution and problem will be
better explained in the commit that does fix it.
Commits after this will solve both these issues, at the expense of breaking
cross hashes. Native hashes won't be broken, thankfully.
--------
Did the temporary ugliness pan out? Of the packages that currently build in
`release-cross.nix`, the only ones that have their hash changed are
`*.gcc.crossDrv` and `bootstrapTools.*.coreutilsMinimal`. In both cases I
think it doesn't matter.
1. GCC when doing a `build = host = target = foreign` build (maximally
cross), still defines environment variables like `CPATH`[1] with
packages. This seems assuredly wrong because whether gcc dynamically
links those, or the programs built by gcc dynamically link those---I
have no idea which case is reality---they should be foreign. Therefore,
in all likelihood, I just made the gcc less broken.
2. Coreutils (ab)used the old cross-compiling infrastructure to depend on
a native version of itself. When coreutils was overwritten to be built
with fewer features, the native version it used would also be
overwritten because the binding was tight. Now it uses the much looser
`BuildPackages.coreutils` which is just fine as a richer build dep
doesn't cause any problems and avoids a rebuild.
So, in conclusion I'd say the conservatism payed off. Onward to actually
raking the muck in the next PR!
[1]: https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html
2016-12-18 07:51:18 +00:00
|
|
|
|
2018-08-20 15:08:52 +00:00
|
|
|
splicedPackagesWithXorg = splicedPackages // builtins.removeAttrs splicedPackages.xorg [
|
2022-12-24 13:55:22 +00:00
|
|
|
"callPackage"
|
|
|
|
"newScope"
|
|
|
|
"overrideScope"
|
|
|
|
"packages"
|
2018-08-20 15:08:52 +00:00
|
|
|
];
|
2018-10-11 16:27:49 +00:00
|
|
|
|
splice.nix: improve performance with early cut-off
All these https://www.github.com/NixOS/nixpkgs/blob/062c4f59744fcffa2e5aa3ef443dc8b4d1674ed6/pkgs/top-level/splice.nix#L116-L121
are already in pkgs, so they don't have to be added on top again when there's no splicing
|stat | before | after | Δ | Δ% |
|----------------------|----------------|----------------|----------------|-------|
|cpuTime | 767.33 | 757.25 | ↘ 10.08 | -1.31%|
|envs-bytes | 23,767,294,088 | 23,767,243,520 | ↘ 50,568 | -0.00%|
|envs-elements | 1,260,156,605 | 1,260,151,924 | ↘ 4,681 | -0.00%|
|envs-number | 855,377,578 | 855,376,758 | ↘ 820 | -0.00%|
|gc-heapSize | 66,525,835,264 | 64,428,679,168 | ↘ 2,097,156,096| -3.15%|
|gc-totalBytes | 146,231,201,712| 145,437,495,488| ↘ 793,706,224 | -0.54%|
|list-bytes | 3,319,349,160 | 3,319,349,160 | 0 | |
|list-concats | 88,567,304 | 88,567,304 | 0 | |
|list-elements | 414,918,645 | 414,918,645 | 0 | |
|nrAvoided | 989,429,178 | 989,427,108 | ↘ 2,070 | -0.00%|
|nrFunctionCalls | 784,049,358 | 784,048,538 | ↘ 820 | -0.00%|
|nrLookups | 412,401,378 | 412,399,016 | ↘ 2,362 | -0.00%|
|nrOpUpdateValuesCopied| 2,132,453,124 | 2,082,900,933 | ↘ 49,552,191 | -2.32%|
|nrOpUpdates | 99,050,775 | 99,048,489 | ↘ 2,286 | -0.00%|
|nrPrimOpCalls | 411,581,753 | 411,581,753 | 0 | |
|nrThunks | 1,248,612,305 | 1,248,600,848 | ↘ 11,457 | -0.00%|
|sets-bytes | 48,379,815,792 | 47,586,523,600 | ↘ 793,292,192 | -1.64%|
|sets-elements | 2,840,072,218 | 2,790,496,848 | ↘ 49,575,370 | -1.75%|
|sets-number | 183,666,269 | 183,660,877 | ↘ 5,392 | -0.00%|
|sizes-Attr | 16 | 16 | 0 | |
|sizes-Bindings | 16 | 16 | 0 | |
|sizes-Env | 16 | 16 | 0 | |
|sizes-Value | 24 | 24 | 0 | |
|symbols-bytes | 3,454,822 | 3,454,838 | ↗ 16 | 0.00% |
|symbols-number | 188,756 | 188,757 | ↗ 1 | 0.00% |
|values-bytes | 38,132,032,032 | 38,131,756,776 | ↘ 275,256 | -0.00%|
|values-number | 1,588,834,668 | 1,588,823,199 | ↘ 11,469 | -0.00%|
The table was formatted manually from stats copied from ofborg(I forgot how to do it properly), so it may
look a bit wonky
2024-10-21 18:00:54 +00:00
|
|
|
packagesWithXorg = pkgs // builtins.removeAttrs pkgs.xorg [
|
|
|
|
"callPackage"
|
|
|
|
"newScope"
|
|
|
|
"overrideScope"
|
|
|
|
"packages"
|
|
|
|
];
|
|
|
|
|
|
|
|
pkgsForCall = if actuallySplice then splicedPackagesWithXorg else packagesWithXorg;
|
|
|
|
|
top-level: Introduce `buildPackages` for resolving build-time deps
[N.B., this package also applies to the commits that follow it in the same
PR.]
In most cases, buildPackages = pkgs so things work just as before. For
cross compiling, however, buildPackages is resolved as the previous
bootstrapping stage. This allows us to avoid the mkDerivation hacks cross
compiling currently uses today.
To avoid a massive refactor, callPackage will splice together both package
sets. Again to avoid churn, it uses the old `nativeDrv` vs `crossDrv` to do
so. So now, whether cross compiling or not, packages with get a `nativeDrv`
and `crossDrv`---in the non-cross-compiling case they are simply the same
derivation. This is good because it reduces the divergence between the
cross and non-cross dataflow. See `pkgs/top-level/splice.nix` for a comment
along the lines of the preceding paragraph, and the code that does this
splicing.
Also, `forceNativeDrv` is replaced with `forceNativePackages`. The latter
resolves `pkgs` unless the host platform is different from the build
platform, in which case it resolves to `buildPackages`. Note that the
target platform is not important here---it will not prevent
`forcedNativePackages` from resolving to `pkgs`.
--------
Temporarily, we make preserve some dubious decisions in the name of preserving
hashes:
Most importantly, we don't distinguish between "host" and "target" in the
autoconf sense. This leads to the proliferation of *Cross derivations
currently used. What we ought to is resolve native deps of the cross "build
packages" (build = host != target) package set against the "vanilla
packages" (build = host = target) package set. Instead, "build packages"
uses itself, with (informally) target != build in all cases.
This is wrong because it violates the "sliding window" principle of
bootstrapping stages that shifting the platform triple of one stage to the
left coincides with the next stage's platform triple. Only because we don't
explicitly distinguish between "host" and "target" does it appear that the
"sliding window" principle is preserved--indeed it is over the reductionary
"platform double" of just "build" and "host/target".
Additionally, we build libc, libgcc, etc in the same stage as the compilers
themselves, which is wrong because they are used at runtime, not build
time. Fixing this is somewhat subtle, and the solution and problem will be
better explained in the commit that does fix it.
Commits after this will solve both these issues, at the expense of breaking
cross hashes. Native hashes won't be broken, thankfully.
--------
Did the temporary ugliness pan out? Of the packages that currently build in
`release-cross.nix`, the only ones that have their hash changed are
`*.gcc.crossDrv` and `bootstrapTools.*.coreutilsMinimal`. In both cases I
think it doesn't matter.
1. GCC when doing a `build = host = target = foreign` build (maximally
cross), still defines environment variables like `CPATH`[1] with
packages. This seems assuredly wrong because whether gcc dynamically
links those, or the programs built by gcc dynamically link those---I
have no idea which case is reality---they should be foreign. Therefore,
in all likelihood, I just made the gcc less broken.
2. Coreutils (ab)used the old cross-compiling infrastructure to depend on
a native version of itself. When coreutils was overwritten to be built
with fewer features, the native version it used would also be
overwritten because the binding was tight. Now it uses the much looser
`BuildPackages.coreutils` which is just fine as a richer build dep
doesn't cause any problems and avoids a rebuild.
So, in conclusion I'd say the conservatism payed off. Onward to actually
raking the muck in the next PR!
[1]: https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html
2016-12-18 07:51:18 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
{
|
2018-07-09 16:22:23 +00:00
|
|
|
inherit splicePackages;
|
2018-07-06 00:19:07 +00:00
|
|
|
|
top-level: Introduce `buildPackages` for resolving build-time deps
[N.B., this package also applies to the commits that follow it in the same
PR.]
In most cases, buildPackages = pkgs so things work just as before. For
cross compiling, however, buildPackages is resolved as the previous
bootstrapping stage. This allows us to avoid the mkDerivation hacks cross
compiling currently uses today.
To avoid a massive refactor, callPackage will splice together both package
sets. Again to avoid churn, it uses the old `nativeDrv` vs `crossDrv` to do
so. So now, whether cross compiling or not, packages with get a `nativeDrv`
and `crossDrv`---in the non-cross-compiling case they are simply the same
derivation. This is good because it reduces the divergence between the
cross and non-cross dataflow. See `pkgs/top-level/splice.nix` for a comment
along the lines of the preceding paragraph, and the code that does this
splicing.
Also, `forceNativeDrv` is replaced with `forceNativePackages`. The latter
resolves `pkgs` unless the host platform is different from the build
platform, in which case it resolves to `buildPackages`. Note that the
target platform is not important here---it will not prevent
`forcedNativePackages` from resolving to `pkgs`.
--------
Temporarily, we make preserve some dubious decisions in the name of preserving
hashes:
Most importantly, we don't distinguish between "host" and "target" in the
autoconf sense. This leads to the proliferation of *Cross derivations
currently used. What we ought to is resolve native deps of the cross "build
packages" (build = host != target) package set against the "vanilla
packages" (build = host = target) package set. Instead, "build packages"
uses itself, with (informally) target != build in all cases.
This is wrong because it violates the "sliding window" principle of
bootstrapping stages that shifting the platform triple of one stage to the
left coincides with the next stage's platform triple. Only because we don't
explicitly distinguish between "host" and "target" does it appear that the
"sliding window" principle is preserved--indeed it is over the reductionary
"platform double" of just "build" and "host/target".
Additionally, we build libc, libgcc, etc in the same stage as the compilers
themselves, which is wrong because they are used at runtime, not build
time. Fixing this is somewhat subtle, and the solution and problem will be
better explained in the commit that does fix it.
Commits after this will solve both these issues, at the expense of breaking
cross hashes. Native hashes won't be broken, thankfully.
--------
Did the temporary ugliness pan out? Of the packages that currently build in
`release-cross.nix`, the only ones that have their hash changed are
`*.gcc.crossDrv` and `bootstrapTools.*.coreutilsMinimal`. In both cases I
think it doesn't matter.
1. GCC when doing a `build = host = target = foreign` build (maximally
cross), still defines environment variables like `CPATH`[1] with
packages. This seems assuredly wrong because whether gcc dynamically
links those, or the programs built by gcc dynamically link those---I
have no idea which case is reality---they should be foreign. Therefore,
in all likelihood, I just made the gcc less broken.
2. Coreutils (ab)used the old cross-compiling infrastructure to depend on
a native version of itself. When coreutils was overwritten to be built
with fewer features, the native version it used would also be
overwritten because the binding was tight. Now it uses the much looser
`BuildPackages.coreutils` which is just fine as a richer build dep
doesn't cause any problems and avoids a rebuild.
So, in conclusion I'd say the conservatism payed off. Onward to actually
raking the muck in the next PR!
[1]: https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html
2016-12-18 07:51:18 +00:00
|
|
|
# We use `callPackage' to be able to omit function arguments that can be
|
|
|
|
# obtained `pkgs` or `buildPackages` and their `xorg` package sets. Use
|
|
|
|
# `newScope' for sets of packages in `pkgs' (see e.g. `gnome' below).
|
2022-12-24 13:55:22 +00:00
|
|
|
callPackage = pkgs.newScope { };
|
top-level: Introduce `buildPackages` for resolving build-time deps
[N.B., this package also applies to the commits that follow it in the same
PR.]
In most cases, buildPackages = pkgs so things work just as before. For
cross compiling, however, buildPackages is resolved as the previous
bootstrapping stage. This allows us to avoid the mkDerivation hacks cross
compiling currently uses today.
To avoid a massive refactor, callPackage will splice together both package
sets. Again to avoid churn, it uses the old `nativeDrv` vs `crossDrv` to do
so. So now, whether cross compiling or not, packages with get a `nativeDrv`
and `crossDrv`---in the non-cross-compiling case they are simply the same
derivation. This is good because it reduces the divergence between the
cross and non-cross dataflow. See `pkgs/top-level/splice.nix` for a comment
along the lines of the preceding paragraph, and the code that does this
splicing.
Also, `forceNativeDrv` is replaced with `forceNativePackages`. The latter
resolves `pkgs` unless the host platform is different from the build
platform, in which case it resolves to `buildPackages`. Note that the
target platform is not important here---it will not prevent
`forcedNativePackages` from resolving to `pkgs`.
--------
Temporarily, we make preserve some dubious decisions in the name of preserving
hashes:
Most importantly, we don't distinguish between "host" and "target" in the
autoconf sense. This leads to the proliferation of *Cross derivations
currently used. What we ought to is resolve native deps of the cross "build
packages" (build = host != target) package set against the "vanilla
packages" (build = host = target) package set. Instead, "build packages"
uses itself, with (informally) target != build in all cases.
This is wrong because it violates the "sliding window" principle of
bootstrapping stages that shifting the platform triple of one stage to the
left coincides with the next stage's platform triple. Only because we don't
explicitly distinguish between "host" and "target" does it appear that the
"sliding window" principle is preserved--indeed it is over the reductionary
"platform double" of just "build" and "host/target".
Additionally, we build libc, libgcc, etc in the same stage as the compilers
themselves, which is wrong because they are used at runtime, not build
time. Fixing this is somewhat subtle, and the solution and problem will be
better explained in the commit that does fix it.
Commits after this will solve both these issues, at the expense of breaking
cross hashes. Native hashes won't be broken, thankfully.
--------
Did the temporary ugliness pan out? Of the packages that currently build in
`release-cross.nix`, the only ones that have their hash changed are
`*.gcc.crossDrv` and `bootstrapTools.*.coreutilsMinimal`. In both cases I
think it doesn't matter.
1. GCC when doing a `build = host = target = foreign` build (maximally
cross), still defines environment variables like `CPATH`[1] with
packages. This seems assuredly wrong because whether gcc dynamically
links those, or the programs built by gcc dynamically link those---I
have no idea which case is reality---they should be foreign. Therefore,
in all likelihood, I just made the gcc less broken.
2. Coreutils (ab)used the old cross-compiling infrastructure to depend on
a native version of itself. When coreutils was overwritten to be built
with fewer features, the native version it used would also be
overwritten because the binding was tight. Now it uses the much looser
`BuildPackages.coreutils` which is just fine as a richer build dep
doesn't cause any problems and avoids a rebuild.
So, in conclusion I'd say the conservatism payed off. Onward to actually
raking the muck in the next PR!
[1]: https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html
2016-12-18 07:51:18 +00:00
|
|
|
|
splice.nix: improve performance with early cut-off
All these https://www.github.com/NixOS/nixpkgs/blob/062c4f59744fcffa2e5aa3ef443dc8b4d1674ed6/pkgs/top-level/splice.nix#L116-L121
are already in pkgs, so they don't have to be added on top again when there's no splicing
|stat | before | after | Δ | Δ% |
|----------------------|----------------|----------------|----------------|-------|
|cpuTime | 767.33 | 757.25 | ↘ 10.08 | -1.31%|
|envs-bytes | 23,767,294,088 | 23,767,243,520 | ↘ 50,568 | -0.00%|
|envs-elements | 1,260,156,605 | 1,260,151,924 | ↘ 4,681 | -0.00%|
|envs-number | 855,377,578 | 855,376,758 | ↘ 820 | -0.00%|
|gc-heapSize | 66,525,835,264 | 64,428,679,168 | ↘ 2,097,156,096| -3.15%|
|gc-totalBytes | 146,231,201,712| 145,437,495,488| ↘ 793,706,224 | -0.54%|
|list-bytes | 3,319,349,160 | 3,319,349,160 | 0 | |
|list-concats | 88,567,304 | 88,567,304 | 0 | |
|list-elements | 414,918,645 | 414,918,645 | 0 | |
|nrAvoided | 989,429,178 | 989,427,108 | ↘ 2,070 | -0.00%|
|nrFunctionCalls | 784,049,358 | 784,048,538 | ↘ 820 | -0.00%|
|nrLookups | 412,401,378 | 412,399,016 | ↘ 2,362 | -0.00%|
|nrOpUpdateValuesCopied| 2,132,453,124 | 2,082,900,933 | ↘ 49,552,191 | -2.32%|
|nrOpUpdates | 99,050,775 | 99,048,489 | ↘ 2,286 | -0.00%|
|nrPrimOpCalls | 411,581,753 | 411,581,753 | 0 | |
|nrThunks | 1,248,612,305 | 1,248,600,848 | ↘ 11,457 | -0.00%|
|sets-bytes | 48,379,815,792 | 47,586,523,600 | ↘ 793,292,192 | -1.64%|
|sets-elements | 2,840,072,218 | 2,790,496,848 | ↘ 49,575,370 | -1.75%|
|sets-number | 183,666,269 | 183,660,877 | ↘ 5,392 | -0.00%|
|sizes-Attr | 16 | 16 | 0 | |
|sizes-Bindings | 16 | 16 | 0 | |
|sizes-Env | 16 | 16 | 0 | |
|sizes-Value | 24 | 24 | 0 | |
|symbols-bytes | 3,454,822 | 3,454,838 | ↗ 16 | 0.00% |
|symbols-number | 188,756 | 188,757 | ↗ 1 | 0.00% |
|values-bytes | 38,132,032,032 | 38,131,756,776 | ↘ 275,256 | -0.00%|
|values-number | 1,588,834,668 | 1,588,823,199 | ↘ 11,469 | -0.00%|
The table was formatted manually from stats copied from ofborg(I forgot how to do it properly), so it may
look a bit wonky
2024-10-21 18:00:54 +00:00
|
|
|
callPackages = lib.callPackagesWith pkgsForCall;
|
top-level: Introduce `buildPackages` for resolving build-time deps
[N.B., this package also applies to the commits that follow it in the same
PR.]
In most cases, buildPackages = pkgs so things work just as before. For
cross compiling, however, buildPackages is resolved as the previous
bootstrapping stage. This allows us to avoid the mkDerivation hacks cross
compiling currently uses today.
To avoid a massive refactor, callPackage will splice together both package
sets. Again to avoid churn, it uses the old `nativeDrv` vs `crossDrv` to do
so. So now, whether cross compiling or not, packages with get a `nativeDrv`
and `crossDrv`---in the non-cross-compiling case they are simply the same
derivation. This is good because it reduces the divergence between the
cross and non-cross dataflow. See `pkgs/top-level/splice.nix` for a comment
along the lines of the preceding paragraph, and the code that does this
splicing.
Also, `forceNativeDrv` is replaced with `forceNativePackages`. The latter
resolves `pkgs` unless the host platform is different from the build
platform, in which case it resolves to `buildPackages`. Note that the
target platform is not important here---it will not prevent
`forcedNativePackages` from resolving to `pkgs`.
--------
Temporarily, we make preserve some dubious decisions in the name of preserving
hashes:
Most importantly, we don't distinguish between "host" and "target" in the
autoconf sense. This leads to the proliferation of *Cross derivations
currently used. What we ought to is resolve native deps of the cross "build
packages" (build = host != target) package set against the "vanilla
packages" (build = host = target) package set. Instead, "build packages"
uses itself, with (informally) target != build in all cases.
This is wrong because it violates the "sliding window" principle of
bootstrapping stages that shifting the platform triple of one stage to the
left coincides with the next stage's platform triple. Only because we don't
explicitly distinguish between "host" and "target" does it appear that the
"sliding window" principle is preserved--indeed it is over the reductionary
"platform double" of just "build" and "host/target".
Additionally, we build libc, libgcc, etc in the same stage as the compilers
themselves, which is wrong because they are used at runtime, not build
time. Fixing this is somewhat subtle, and the solution and problem will be
better explained in the commit that does fix it.
Commits after this will solve both these issues, at the expense of breaking
cross hashes. Native hashes won't be broken, thankfully.
--------
Did the temporary ugliness pan out? Of the packages that currently build in
`release-cross.nix`, the only ones that have their hash changed are
`*.gcc.crossDrv` and `bootstrapTools.*.coreutilsMinimal`. In both cases I
think it doesn't matter.
1. GCC when doing a `build = host = target = foreign` build (maximally
cross), still defines environment variables like `CPATH`[1] with
packages. This seems assuredly wrong because whether gcc dynamically
links those, or the programs built by gcc dynamically link those---I
have no idea which case is reality---they should be foreign. Therefore,
in all likelihood, I just made the gcc less broken.
2. Coreutils (ab)used the old cross-compiling infrastructure to depend on
a native version of itself. When coreutils was overwritten to be built
with fewer features, the native version it used would also be
overwritten because the binding was tight. Now it uses the much looser
`BuildPackages.coreutils` which is just fine as a richer build dep
doesn't cause any problems and avoids a rebuild.
So, in conclusion I'd say the conservatism payed off. Onward to actually
raking the muck in the next PR!
[1]: https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html
2016-12-18 07:51:18 +00:00
|
|
|
|
splice.nix: improve performance with early cut-off
All these https://www.github.com/NixOS/nixpkgs/blob/062c4f59744fcffa2e5aa3ef443dc8b4d1674ed6/pkgs/top-level/splice.nix#L116-L121
are already in pkgs, so they don't have to be added on top again when there's no splicing
|stat | before | after | Δ | Δ% |
|----------------------|----------------|----------------|----------------|-------|
|cpuTime | 767.33 | 757.25 | ↘ 10.08 | -1.31%|
|envs-bytes | 23,767,294,088 | 23,767,243,520 | ↘ 50,568 | -0.00%|
|envs-elements | 1,260,156,605 | 1,260,151,924 | ↘ 4,681 | -0.00%|
|envs-number | 855,377,578 | 855,376,758 | ↘ 820 | -0.00%|
|gc-heapSize | 66,525,835,264 | 64,428,679,168 | ↘ 2,097,156,096| -3.15%|
|gc-totalBytes | 146,231,201,712| 145,437,495,488| ↘ 793,706,224 | -0.54%|
|list-bytes | 3,319,349,160 | 3,319,349,160 | 0 | |
|list-concats | 88,567,304 | 88,567,304 | 0 | |
|list-elements | 414,918,645 | 414,918,645 | 0 | |
|nrAvoided | 989,429,178 | 989,427,108 | ↘ 2,070 | -0.00%|
|nrFunctionCalls | 784,049,358 | 784,048,538 | ↘ 820 | -0.00%|
|nrLookups | 412,401,378 | 412,399,016 | ↘ 2,362 | -0.00%|
|nrOpUpdateValuesCopied| 2,132,453,124 | 2,082,900,933 | ↘ 49,552,191 | -2.32%|
|nrOpUpdates | 99,050,775 | 99,048,489 | ↘ 2,286 | -0.00%|
|nrPrimOpCalls | 411,581,753 | 411,581,753 | 0 | |
|nrThunks | 1,248,612,305 | 1,248,600,848 | ↘ 11,457 | -0.00%|
|sets-bytes | 48,379,815,792 | 47,586,523,600 | ↘ 793,292,192 | -1.64%|
|sets-elements | 2,840,072,218 | 2,790,496,848 | ↘ 49,575,370 | -1.75%|
|sets-number | 183,666,269 | 183,660,877 | ↘ 5,392 | -0.00%|
|sizes-Attr | 16 | 16 | 0 | |
|sizes-Bindings | 16 | 16 | 0 | |
|sizes-Env | 16 | 16 | 0 | |
|sizes-Value | 24 | 24 | 0 | |
|symbols-bytes | 3,454,822 | 3,454,838 | ↗ 16 | 0.00% |
|symbols-number | 188,756 | 188,757 | ↗ 1 | 0.00% |
|values-bytes | 38,132,032,032 | 38,131,756,776 | ↘ 275,256 | -0.00%|
|values-number | 1,588,834,668 | 1,588,823,199 | ↘ 11,469 | -0.00%|
The table was formatted manually from stats copied from ofborg(I forgot how to do it properly), so it may
look a bit wonky
2024-10-21 18:00:54 +00:00
|
|
|
newScope = extra: lib.callPackageWith (pkgsForCall // extra);
|
2018-07-07 18:28:42 +00:00
|
|
|
|
2022-12-24 15:33:06 +00:00
|
|
|
# prefill 2 fields of the function for convenience
|
2023-07-28 21:04:09 +00:00
|
|
|
makeScopeWithSplicing = lib.makeScopeWithSplicing splicePackages pkgs.newScope;
|
2023-08-13 23:47:59 +00:00
|
|
|
makeScopeWithSplicing' = lib.makeScopeWithSplicing' { inherit splicePackages; inherit (pkgs) newScope; };
|
2022-12-24 15:33:06 +00:00
|
|
|
|
|
|
|
# generate 'otherSplices' for 'makeScopeWithSplicing'
|
2024-04-30 16:05:33 +00:00
|
|
|
generateSplicesForMkScope = attrs:
|
2022-12-24 15:33:06 +00:00
|
|
|
let
|
2024-04-30 16:05:33 +00:00
|
|
|
split = X: [ X ] ++ (
|
|
|
|
if builtins.isList attrs
|
|
|
|
then attrs
|
|
|
|
else if builtins.isString attrs
|
|
|
|
then lib.splitString "." attrs
|
|
|
|
else throw "generateSplicesForMkScope must be passed a list of string or string"
|
|
|
|
);
|
|
|
|
bad = throw "attribute should be found";
|
2022-12-24 15:33:06 +00:00
|
|
|
in
|
|
|
|
{
|
2024-04-30 16:05:33 +00:00
|
|
|
selfBuildBuild = lib.attrByPath (split "pkgsBuildBuild") bad pkgs;
|
|
|
|
selfBuildHost = lib.attrByPath (split "pkgsBuildHost") bad pkgs;
|
|
|
|
selfBuildTarget = lib.attrByPath (split "pkgsBuildTarget") bad pkgs;
|
|
|
|
selfHostHost = lib.attrByPath (split "pkgsHostHost") bad pkgs;
|
|
|
|
selfHostTarget = lib.attrByPath (split "pkgsHostTarget") bad pkgs;
|
2022-12-24 15:33:06 +00:00
|
|
|
selfTargetTarget = lib.attrByPath (split "pkgsTargetTarget") { } pkgs;
|
|
|
|
};
|
|
|
|
|
2018-07-07 18:28:42 +00:00
|
|
|
# Haskell package sets need this because they reimplement their own
|
|
|
|
# `newScope`.
|
splice.nix: improve performance with early cut-off
All these https://www.github.com/NixOS/nixpkgs/blob/062c4f59744fcffa2e5aa3ef443dc8b4d1674ed6/pkgs/top-level/splice.nix#L116-L121
are already in pkgs, so they don't have to be added on top again when there's no splicing
|stat | before | after | Δ | Δ% |
|----------------------|----------------|----------------|----------------|-------|
|cpuTime | 767.33 | 757.25 | ↘ 10.08 | -1.31%|
|envs-bytes | 23,767,294,088 | 23,767,243,520 | ↘ 50,568 | -0.00%|
|envs-elements | 1,260,156,605 | 1,260,151,924 | ↘ 4,681 | -0.00%|
|envs-number | 855,377,578 | 855,376,758 | ↘ 820 | -0.00%|
|gc-heapSize | 66,525,835,264 | 64,428,679,168 | ↘ 2,097,156,096| -3.15%|
|gc-totalBytes | 146,231,201,712| 145,437,495,488| ↘ 793,706,224 | -0.54%|
|list-bytes | 3,319,349,160 | 3,319,349,160 | 0 | |
|list-concats | 88,567,304 | 88,567,304 | 0 | |
|list-elements | 414,918,645 | 414,918,645 | 0 | |
|nrAvoided | 989,429,178 | 989,427,108 | ↘ 2,070 | -0.00%|
|nrFunctionCalls | 784,049,358 | 784,048,538 | ↘ 820 | -0.00%|
|nrLookups | 412,401,378 | 412,399,016 | ↘ 2,362 | -0.00%|
|nrOpUpdateValuesCopied| 2,132,453,124 | 2,082,900,933 | ↘ 49,552,191 | -2.32%|
|nrOpUpdates | 99,050,775 | 99,048,489 | ↘ 2,286 | -0.00%|
|nrPrimOpCalls | 411,581,753 | 411,581,753 | 0 | |
|nrThunks | 1,248,612,305 | 1,248,600,848 | ↘ 11,457 | -0.00%|
|sets-bytes | 48,379,815,792 | 47,586,523,600 | ↘ 793,292,192 | -1.64%|
|sets-elements | 2,840,072,218 | 2,790,496,848 | ↘ 49,575,370 | -1.75%|
|sets-number | 183,666,269 | 183,660,877 | ↘ 5,392 | -0.00%|
|sizes-Attr | 16 | 16 | 0 | |
|sizes-Bindings | 16 | 16 | 0 | |
|sizes-Env | 16 | 16 | 0 | |
|sizes-Value | 24 | 24 | 0 | |
|symbols-bytes | 3,454,822 | 3,454,838 | ↗ 16 | 0.00% |
|symbols-number | 188,756 | 188,757 | ↗ 1 | 0.00% |
|values-bytes | 38,132,032,032 | 38,131,756,776 | ↘ 275,256 | -0.00%|
|values-number | 1,588,834,668 | 1,588,823,199 | ↘ 11,469 | -0.00%|
The table was formatted manually from stats copied from ofborg(I forgot how to do it properly), so it may
look a bit wonky
2024-10-21 18:00:54 +00:00
|
|
|
__splicedPackages = if actuallySplice then splicedPackages // { recurseForDerivations = false; } else pkgs;
|
top-level: Introduce `buildPackages` for resolving build-time deps
[N.B., this package also applies to the commits that follow it in the same
PR.]
In most cases, buildPackages = pkgs so things work just as before. For
cross compiling, however, buildPackages is resolved as the previous
bootstrapping stage. This allows us to avoid the mkDerivation hacks cross
compiling currently uses today.
To avoid a massive refactor, callPackage will splice together both package
sets. Again to avoid churn, it uses the old `nativeDrv` vs `crossDrv` to do
so. So now, whether cross compiling or not, packages with get a `nativeDrv`
and `crossDrv`---in the non-cross-compiling case they are simply the same
derivation. This is good because it reduces the divergence between the
cross and non-cross dataflow. See `pkgs/top-level/splice.nix` for a comment
along the lines of the preceding paragraph, and the code that does this
splicing.
Also, `forceNativeDrv` is replaced with `forceNativePackages`. The latter
resolves `pkgs` unless the host platform is different from the build
platform, in which case it resolves to `buildPackages`. Note that the
target platform is not important here---it will not prevent
`forcedNativePackages` from resolving to `pkgs`.
--------
Temporarily, we make preserve some dubious decisions in the name of preserving
hashes:
Most importantly, we don't distinguish between "host" and "target" in the
autoconf sense. This leads to the proliferation of *Cross derivations
currently used. What we ought to is resolve native deps of the cross "build
packages" (build = host != target) package set against the "vanilla
packages" (build = host = target) package set. Instead, "build packages"
uses itself, with (informally) target != build in all cases.
This is wrong because it violates the "sliding window" principle of
bootstrapping stages that shifting the platform triple of one stage to the
left coincides with the next stage's platform triple. Only because we don't
explicitly distinguish between "host" and "target" does it appear that the
"sliding window" principle is preserved--indeed it is over the reductionary
"platform double" of just "build" and "host/target".
Additionally, we build libc, libgcc, etc in the same stage as the compilers
themselves, which is wrong because they are used at runtime, not build
time. Fixing this is somewhat subtle, and the solution and problem will be
better explained in the commit that does fix it.
Commits after this will solve both these issues, at the expense of breaking
cross hashes. Native hashes won't be broken, thankfully.
--------
Did the temporary ugliness pan out? Of the packages that currently build in
`release-cross.nix`, the only ones that have their hash changed are
`*.gcc.crossDrv` and `bootstrapTools.*.coreutilsMinimal`. In both cases I
think it doesn't matter.
1. GCC when doing a `build = host = target = foreign` build (maximally
cross), still defines environment variables like `CPATH`[1] with
packages. This seems assuredly wrong because whether gcc dynamically
links those, or the programs built by gcc dynamically link those---I
have no idea which case is reality---they should be foreign. Therefore,
in all likelihood, I just made the gcc less broken.
2. Coreutils (ab)used the old cross-compiling infrastructure to depend on
a native version of itself. When coreutils was overwritten to be built
with fewer features, the native version it used would also be
overwritten because the binding was tight. Now it uses the much looser
`BuildPackages.coreutils` which is just fine as a richer build dep
doesn't cause any problems and avoids a rebuild.
So, in conclusion I'd say the conservatism payed off. Onward to actually
raking the muck in the next PR!
[1]: https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html
2016-12-18 07:51:18 +00:00
|
|
|
}
|