java-packages.nix: detect i686 using stdenv.hostPlatform #179648
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The problem
java-packages.nix
attempts to automatically decide which java to use for bootstrapping. When this works, it works well. However when it fails due to the user settingconfig.allowNonSource=false
on a non-x86 platform, the reported failure is extremely confusing and does not mention theNIXPKGS_ALLOW_NONSOURCE=1
option to proceed, or thatallowNonSource
had anything to do with the eval failure.Why the problem is happening
Currently,
java-packages.nix
makes its detection choice based onadoptopenjdk.jdk-hotspot.meta.available
. If the user has setconfig.allowNonSource=false
then theadoptopenjdk-bin
packages will all report_.meta.available==false
. Ifadoptopenjdk.jdk-hotspot.meta.available==false
then the detection code will proceed to usecallPackage path args
, even if that package is alsometa.unavailable
for end-user-unfixable reasons.In the case of
openjdk8
, thepath
passed is anix
expression that only works on x86. The user has two options for continuing the build: buy an x86 machine or add anallowNonSource
exception for the bootstrap jdk. The second option is generally preferred, but the user is only offered the first option.The fix for the problem
The following comment appears above the line in
java-packages.nix
which does the automatic selection:Since the intent here was to decide based on "i686-ness", let's query the authoritative source for i686ness in nixpkgs:
stdenv.hostPlatform
.Things done
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)