Skip to content

Move stdenvCross and customStdenv to pkgs/stdenv#20108

Merged
Ericson2314 merged 6 commits intoNixOS:masterfrom
Ericson2314:top-level-cleanup
Nov 8, 2016
Merged

Move stdenvCross and customStdenv to pkgs/stdenv#20108
Ericson2314 merged 6 commits intoNixOS:masterfrom
Ericson2314:top-level-cleanup

Conversation

@Ericson2314
Copy link
Member

@Ericson2314 Ericson2314 commented Nov 2, 2016

Motivation for this change

Cleanup enabled by #19940. This too leads up to #15043. I pulled some more commits from #15043 so that now top-level/stdenv.nix hardly needs to exist.

Cross compiling still behaviors weird (I don't want to change semantics with this patch), but the weirdness is syntactically isolated from normal behavior: pkgs/stdenv/cross/default.nix won't be imported unless one is cross compiling and the weirdness is confined to there.

@zimbatm this should basically be what you reviewed originally, modulo identifier renaming.

Things done

I modified @DavidEGrayson's excellent test script at https://gist.github.com/Ericson2314/fc745290db68b20235bdc457961b3658 . It now just checks for all combinations with all combinations: native target, cross compiling, custom stdenvs, and custom stdenvs + cross compiling. You can replicate my results by running

nix-instantiate --eval -E 'import (builtins.fetchTarball https://gist.github.com/Ericson2314/fc745290db68b20235bdc457961b3658/archive/master.tar.gz) {}' -A testsPass

CC @nbp @DavidEGrayson

@mention-bot
Copy link

@Ericson2314, thanks for your PR! By analyzing the history of the files in this pull request, we identified @nbp to be a potential reviewer.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indenting by 6 spaces without lining up to something seems odd.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm it's supposed to be beginning of res + 2, but that does look odd. Seeing that

let # note newline
  foo = ...;
  bar = ...;

would be IMO proper style for multiple lets, I'll just unindent back to two from let.

@DavidEGrayson
Copy link
Contributor

DavidEGrayson commented Nov 2, 2016

Besides my minor indentation complaint, it looks good to me. You are basically cleaning up the arguments that are given to the top-level stdenv.nix and all-packages.nix.

EDIT: The pull request has changed dramatically since I made this comment and I have not had time to review it fully.

@Ericson2314
Copy link
Member Author

Ericson2314 commented Nov 2, 2016

@DavidEGrayson so while you definitely want to rebase on this, you probably also should rebase on top of #15043^ (i.e. all but the last commit, subsuming this), and furthermore also take a look at @vcunat's stdenv which I linked earlier. Lot of indirection there sorry :/.

To make all that less of a pain I rebased my bitrotted rebase of vcunat's stdenv on #15043^: https://github.com/Ericson2314/nixpkgs/tree/vcunat-cross-stdenv . For context, @vcunat's original branch is https://github.com/vcunat/nixpkgs/tree/v/cross-native-rework .

@nbp
Copy link
Member

nbp commented Nov 2, 2016

I kind of like topLevelArguments, why would that be a mandatory change?

@Ericson2314
Copy link
Member Author

@nbp in the follow up PR they completely diverge https://github.com/NixOS/nixpkgs/pull/15043/files#diff-69df24a05ec3d577cb638113e9837ae1R49; during development (as 1 big PR) the ... just makes things harder.

@DavidEGrayson
Copy link
Contributor

DavidEGrayson commented Nov 2, 2016

I actually think topLevelArguments was misleading since it contained things like lib that were not arguments to top-level/default.nix. Now that were are using @ args, that won't happen again.

@Ericson2314
Copy link
Member Author

I'm working on maybe moving some commits from the original (now followup) PR to this, to motivate (either way, i debug them so no loss). The @vcunat stuff may be needed just to get things working again, but that may swing things in the direction of leave this as is to not over-complicate with semantic change.

@Ericson2314
Copy link
Member Author

Ok, added more commits from the original PR because I believe I figured out how to preserve exact semantics, yay!

@Ericson2314
Copy link
Member Author

@DavidEGrayson thanks for your test script, it gives me much more confidence in this :). I still recommend looking at the my vcunat-cross-stdenv branch, but that branch will be rebased on #15043 in a moment so there's absolutely no reason to wait for that follow-up PR!

@DavidEGrayson
Copy link
Contributor

I'm glad you found it useful!

@Ericson2314
Copy link
Member Author

Do you have a moment for IRC?

@Ericson2314
Copy link
Member Author

Ericson2314 commented Nov 3, 2016

@nbp this should be ready to go.

@Ericson2314 Ericson2314 force-pushed the top-level-cleanup branch 2 times, most recently from 336e22a to f822985 Compare November 3, 2016 23:14
@Ericson2314
Copy link
Member Author

@nbp ok now this is actually ready to go! all the stdenv combinations have been tested. And yes...I did fine a bug in in stdenvCustom, so shame on me for not testing it before.

Copy link
Member

@nbp nbp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the nits, and I would be ok for merging.

The allowCustomOverrides attribute is added as argument of the top-level of nixpkgs set computation to compensate from the fact that the stdenv replacement and the stdenvCross do benefit from the overridden configuration provided by the user, as opposed to the bootstrapping stdenv.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Notice the the

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not use with, to prevent issues caused by adding names such as vanillaStdenv & crossSystem at the top-level of nixpkgs set, or from the config override.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is working, because the derivation used to build the stdenvCross are in fact using forceNativeDrv to use the nativeDrv attribute of the resulting derivation build with vanillaStdenv (second argument of makeStdenvCross) So technically you could use the same buildPackages as used in custom.nix.

I think you can fix this comment for now, and make a follow-up patch for that after.

Copy link
Member Author

@Ericson2314 Ericson2314 Nov 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I originally had a proper fix along those lines, but was getting missing identifier errors. Follow-up patch is the intent, but there is some broken code out there that will make it non-trivial.

By fixing comment, you mean add basically what you wrote explaining why this works at all? Or just the "the the"?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both, the "the the", and explaining why this works.

@nbp
Copy link
Member

nbp commented Nov 5, 2016

I suggest you rename this pull-request to “Move stdenvCross and customStdenv to pkgs/stdenv.”

@nbp nbp added 0.kind: enhancement Add something new or improve an existing system. 8.has: clean-up This PR removes packages or removes other cruft labels Nov 5, 2016
@nbp nbp added this to the 17.03 milestone Nov 5, 2016
@Ericson2314 Ericson2314 changed the title Top level cleanup Move stdenvCross and customStdenv to pkgs/stdenv Nov 5, 2016
@Ericson2314
Copy link
Member Author

@nbp Thanks! I will fix those things momentarily.

...but actually is weird just like the original
@Ericson2314
Copy link
Member Author

Ericson2314 commented Nov 7, 2016

@nbp Ok fixed everything (and tested again)! I took part of your review message and also made it a comment. More explanation never hurts!

@Ericson2314 Ericson2314 merged commit a24728f into NixOS:master Nov 8, 2016
@Ericson2314 Ericson2314 deleted the top-level-cleanup branch November 11, 2016 03:55
@Ericson2314 Ericson2314 added the 6.topic: cross-compilation Building packages on a different platform than they will be used on label Dec 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0.kind: enhancement Add something new or improve an existing system. 6.topic: cross-compilation Building packages on a different platform than they will be used on 8.has: clean-up This PR removes packages or removes other cruft

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants