New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cross lib foundation #25099
Cross lib foundation #25099
Conversation
@Ericson2314, thanks for your PR! By analyzing the history of the files in this pull request, we identified @edolstra, @zimbatm and @Profpatsch to be potential reviewers. |
doc/cross-compilation.xml
Outdated
@@ -167,6 +167,11 @@ | |||
Because of this, a best-of-both-worlds solution is in the works with no splicing or explicit access of <varname>buildPackages</varname> needed. | |||
For now, feel free to use either method. | |||
</para> | |||
<note><para> | |||
There is also a "backlink" <varname>__targetPackages</varname>, yielding a package set which whose <varname>buildPackages</varname> is the current package set. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"which whose" is a little awkward... I'm not sure what to use but I think just using one of those words is enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah should just be "whose".
lib/lists.nix
Outdated
in | ||
f_0 | ||
|
||
New in 17.10 --- Until that release is cut, feel free to modify this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: I think it's 17.09 not 17.10
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
pkgs/top-level/stage.nix
Outdated
# defined internally as the produced package set as itself. | ||
# | ||
# THIS IS A HACK for compilers that don't think critically about cross- | ||
# compilation. Please do *not* use unless you really know what you are doing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, but what compilers need __targetPackages? It looks like from your other commits that it is only used by glibc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GHC, certain GCC stages as exists, cc-wrapper with libc.
lib/lists.nix
Outdated
New in 17.10 --- Until that release is cut, feel free to modify this | ||
function (and update its uses accordingly). | ||
*/ | ||
dfold = op: lnul: rnul: list: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m really not sure this is general enough to be in the base library. The use-cases seem very limited.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved out of lib and into booter.nix
for now.
@@ -87,6 +94,8 @@ let | |||
stdenvBootstappingAndPlatforms = self: super: { | |||
buildPackages = (if buildPackages == null then self else buildPackages) | |||
// { recurseForDerivations = false; }; | |||
__targetPackages = (if __targetPackages == null then self else __targetPackages) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using null
here seems kind of forced—what’s the difference to []
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Err it would normally be an attribute set. I wanted to distinguish { .. }
--- the target package set is different and contains these packages , from null
-- the target package set is the same as the regular package set. This allows me to avoid splicing, which is expensive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/NixOS/nixpkgs/pull/25099/files#diff-69df24a05ec3d577cb638113e9837ae1R52 is a somewhat poorly-worded explanation of that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed wording
12f02e7
to
fad54d8
Compare
- `pkgs` is self-similar, and thus already spliced - `buildPackages` is an ingredient of splicing and should be kept as is - The platforms are not packages or package sets and couldn't be spliced There's probably other things that shouldn't be spliced too. The best long- term solution is simply to stop splicing altogether.
Each bootstrapping stage ought to just depend on the previous stage, but poorly-written compilers break this elegence. This provides an easy-enough way to depend on the next stage: targetPackages. PLEASE DO NOT USE IT UNLESS YOU MUST! I'm hoping someday in a pleasant future I can revert this commit :)
fad54d8
to
863d79b
Compare
Moved dfold out of lib and clarified answer to question in code
Motivation for this change
Two innocent native- and cross-hash-preserving change from #25047. It's hard to motivate them on their own (and this is the second sub PR I've made!) but trust me they're needed :). At least they are safe to merge on their own.
[Oh, alright, the first fixes some bugs were we splice together the splice leading packages to bleed past adjacent stages (only adjacent stages are spliced). The second allows compile package hacks where we need to break the rules and depend on something from a future stage because the compiler insists on building the standard library.]
Things done
(nix.useSandbox on NixOS,
or option
build-use-sandbox
innix.conf
on non-NixOS)
nix-shell -p nox --run "nox-review wip"
./result/bin/
)