about summary refs log tree commit diff
path: root/pkgs/top-level/java-packages.nix
diff options
context:
space:
mode:
authorAdam Joseph <adam@westernsemico.com>2022-06-29 17:29:39 -0700
committerAdam Joseph <adam@westernsemico.com>2022-11-04 17:59:00 -0700
commit1a61c13bfa63c731e7dd245861b4e36e33a7b969 (patch)
tree96a4497f3c45861053915bf81a36ca271d127653 /pkgs/top-level/java-packages.nix
parent0a471a0b94864675629effcd73e4b62b60cc4bdf (diff)
java-packages.nix: detect i686 using stdenv.hostPlatform
`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 setting `config.allowNonSource=false` on a
non-x86 platform, the reported failure is extremely confusing and does
not mention the `NIXPKGS_ALLOW_NONSOURCE=1` option to proceed, or
that `allowNonSource` had anything to do with the eval failure.

Here's why this is happening:

Currently, `java-packages.nix` makes its detection choice based on
`adoptopenjdk.jdk-hotspot.meta.available`.  If the user has set
`config.allowNonSource=false` then the `adoptopenjdk-bin` packages
will all report `_.meta.available==false`.  If
`adoptopenjdk.jdk-hotspot.meta.available==false` then the detection
code will proceed to use `callPackage path args`, *even if that
package is **also** `meta.unavailable`* for end-user-unfixable
reasons.

In the case of `openjdk8`, the `path` passed is a `nix` expression
that only works on x86.  The user has two options for continuing the
build: buy an x86 machine or add an `allowNonSource` exception for the
bootstrap jdk.  The second option is generally preferred, but the user
is only offered the first option.

The following comment appears above the line in `java-packages.nix`
which does the automatic selection:

```
/* adoptopenjdk not available for i686, so fall back to our old builds for bootstrapping */
```

Since the intent here was to decide based on "i686-ness", let's query
the authoritative source for i686ness in nixpkgs: `stdenv.hostPlatform`.
Diffstat (limited to 'pkgs/top-level/java-packages.nix')
-rw-r--r--pkgs/top-level/java-packages.nix2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkgs/top-level/java-packages.nix b/pkgs/top-level/java-packages.nix
index 8a419a6a0960e..dd2f70d7529f6 100644
--- a/pkgs/top-level/java-packages.nix
+++ b/pkgs/top-level/java-packages.nix
@@ -44,7 +44,7 @@ in {
 
     mkBootstrap = adoptopenjdk: path: args:
       /* adoptopenjdk not available for i686, so fall back to our old builds for bootstrapping */
-      if   adoptopenjdk.jdk-hotspot.meta.available
+      if   !stdenv.hostPlatform.isi686
       then
         # only linux has the gtkSupport option
         if stdenv.isLinux