-
-
Notifications
You must be signed in to change notification settings - Fork 15k
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
Normalize bootstrapping #21415
Normalize bootstrapping #21415
Conversation
@Ericson2314, thanks for your PR! By analyzing the history of the files in this pull request, we identified @edolstra, @errge, @gridaphobe, @LnL7 and @copumpkin to be potential reviewers. |
Hey @Ericson2314, I'd say this on IRC but it looks like you disconnected: thanks a ton for doing all this refactoring work! The cross compiling stuff has looked a little sketchy for a while, and I'm really looking forward to seeing the wrinkles ironed out. 🍻 Oh, and Happy Holidays! |
ffc6957
to
7fdf2ab
Compare
Bit busy with the holidays, but will review this when I get the chance! |
7fdf2ab
to
de2868b
Compare
Review started, will probably take a few days to finish going through it all |
@shlevy Thanks so much! Oh and to be clear, I've written it with the intention of a commit-by-commit review, which should make it more bights but each one less of a mouthful. |
@shlevy friendly ping :) |
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.
Can you explain a bit more what this new abstraction is and why its preferable?
EDIT: This review is first commit only.
rec { | ||
# It would be nice to just use `++`, but we can't forget about the old | ||
# `basecase`. I (@Ericson2314) am tempted to use a heterogeneous list instead. | ||
extendStages = { baseCase, stageFuns }: more: { |
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.
Please document this or, if its use should be obvious from context, move it to a let
at the top so it's not exported.
# isn't already set. | ||
withAllowCustomOverrides = lib.lists.imap | ||
(index: stageFun: prevStage: | ||
{ allowCustomOverrides = index == 1; } # first element, 1-indexed |
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.
This doesn't match the comment ("all but the final stage") if the list has the stages in order...
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.
Oh whoops! Yeah originally I had reverse order.
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.
Can't seem to approve commits separately, 👍 on "top-level: Inherit system
and platform
in stage.nix not all-packages.nix"
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.
Review of "top-level: Modernize stdenv.overrides giving it self and super"
Please find some place (perhaps the nixpkgs manual changelog?) to document this change.
Otherwise 👍
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.
Review of "top-level: Do stdenvOverrides in stage.nix even if crossSystem exists.":
Expand in commit message why the previous comment no longer applies.
# | ||
# We don't want stdenv overrides in the case of cross-building, or | ||
# otherwise the basic overridden packages will not be built with the | ||
# crossStdenv adapter. |
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.
Why doesn't this comment apply any more?
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.
In commit message, basically the cross stdenv cleans up after itself rather than leaving stage.nix to do it.
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.
👍
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.
Review of "linux stdenv: Utilize overrides and prevStage better":
Why does this change gcc.cc
to gcc-unwrapped
?
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.
Review of "linux stdenv: Remove stray use of stage0 to bootstrap more elegantly"
Can you explain the role of ccWrapperStdenv
in this commit?
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.
Review of "linux stdenv: Inline stage funs to conform to new convention"
Diff is too hard to verify, but if all this is is code shuffling to meet the new standard then 👍
Thanks!! Will get to work on these right away |
I'm going to make those changes, make extendStages actually |
Well I'd like to see the explanation for why this new abstraction is better first... |
@shlevy Sure, I was including that in this list of things to do, but yeah that deserves a re-review. |
Document breaking change in 17.03 release notes
3f71837
to
af101e1
Compare
As a bonus, the big inline commit is now less indented causing less churn. |
https://github.com/NixOS/nixpkgs/pull/21415/files#diff-19c9515018ff76dea736b57000a62d5b is the new improved motivation |
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 the one indexing issue but overall looks good!
# isn't already set. | ||
withAllowCustomOverrides = lib.lists.imap | ||
(index: stageFun: prevStage: | ||
{ allowCustomOverrides = index == 1; } # first element, 1-indexed |
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.
This seems wrong still...
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.
See the reverse below?, and then foldr not foldl?
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.
👍 Not a big deal, but maybe change the comment on this line?
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.
Sure!
inherit (args) stdenv; | ||
in | ||
if args.__raw or false | ||
then args |
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.
Should maybe document somewhere that this function doesn't add __bootPackages
when __raw == true
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.
Oh whoops, that's not intentional. Not supposed to be that raw :).
crossSystem = null; | ||
# Ignore custom stdenvs when cross compiling for compatability | ||
# Remove config.replaceStdenv to ensure termination. |
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.
No need to change this, but can you explain the termination issue when replaceStdenv
is there?
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.
Ooops, old comment should still be there, bad copy paste from custom/default.nix
stdenvFunc ? import ../stdenv | ||
, # A function booting the final package set for a specific standard | ||
# environment. See below for the arguments given to that function, | ||
# the the type of list it returns. |
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.
"the the"?
# | ||
# We don't want stdenv overrides in the case of cross-building, or | ||
# otherwise the basic overridden packages will not be built with the | ||
# crossStdenv adapter. |
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.
👍
Introduce new abstraction, `stdenv/booter.nix` for composing bootstraping stages, and use it everywhere for consistency. See that file for more doc. Stdenvs besides Linux and Darwin are completely refactored to utilize this. Those two, due to their size and complexity, are minimally edited for easier reviewing. No hashes should be changed.
Instead, the cross stdenv will patch up the override field -- the complexity is now confined to the one place it matters.
…ges.nix These are not packages, and so its more elegant to do this outside of all-packages.nix.
`gcc-unwrapped` basically replaces `gccPlain`. It may seem like an ugly polution to stick it in all-packages, but a future PR will enshrine this `*-unwrapped` pattern. In any event, the long term goal is stdenvs might need to tweak how compilers are booted and wrapped, but the code to build the unwrapped compilers themselves should be generic.
Code is just moved around
af101e1
to
ff35560
Compare
Linux tests passed (which do eval darwin), darwin job seems to have a backlog, I'm merging 😀! |
Split out from #21268
This PR introduces a new abstraction for dealing with stdenv bootstrapping. It doesn't really make anything shorter, but at least it enforces a consistent ideom across all of them. I've made all the stdenvs but darwin really embrace the new abstraction. Darwin is a bit bigger, and so I made minimal changes to make it use it, but I'll refactor it to make it embrace the new abstraction too if wanted.
#21268 builds on this to make cross compiling not a dirty hack.