In preparation for the deprecation of `stdenv.isX`.
These shorthands are not conducive to cross-compilation because they
hide the platforms.
Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way
One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059
There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.
```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
Files like `pkgs/development/haskell-modules/configuration-ghc-8.10.x.nix`
assume `ghc` always has an `llvmPackages` attribue. Let's expose `null`
value from `ghcjs` to allow it's propagation.
This fixes package evaluation for `ghcjs` packages.
Apply a patch from upstream `ghcjs/ghcjs/ghc-8.10` (not yet present in
the obsidiansystems fork we follow) to fix a build failure caused by an
emscripten update.
As the patch itself modifies patches that are used during configuration
(by `makePackages.sh`), it must be applied in the configured source derivation.
Before this change the GHCJS build fails on Linux with:
```
Setup: Missing dependency on a foreign library:
* Missing (or bad) header file: ghc/utils/unlit/fs.h
```
The root cause is that the `./ghc/configure.ac` script is
responsible for copying `./ghc/utils/fs/fs.h` to
`./ghc/utils/unlit/fs.h`, but the script exits early if a C
compiler is not present.
This fixes that by ensuring that the C compiler is present
on all platforms (not just Darwin), so that the build now
works on Linux, too.
Before this change the `ghcjs` build fails with:
```
checking host system type... Invalid configuration `js-ghcjs': machine `js-unknown' not recognized
configure: error: …/bin/bash …/configured-ghcjs-src/lib/boot/pkg/unix/config.sub js-ghcjs failed
```
This fails because the `updateAutotoolsGnuConfigScriptsHook` overrides the
`config.sub` in the `unix` boot package to use the newer upstream
version of `config.sub`, but the newer version is incompatible with the
`js-ghcjs` host string used to configure the `unix` package. The
fix is to undo the override, because the `config.sub` vendored within
`ghc` supports the host string correctly.
The 8.4.x version of ghcjs hasn't compiled successfully
in ages, so I reckon it's unused. The even older code
in pkgs/development/compilers/ghcjs is unused entirely;
it's not even referenced in Nixpkgs.
We keep the latest minor release of each one of the last 3 major releases,
which currently are GHC versions 8.2.2, 8.4.4, and 8.6.1. We also have
ghc-HEAD, but this doesn't count.
Dropping these compilers implied that we have to drop the corresponding
versions of ghcjs, too. We can also drop a shitload of obsolete compiler
patches that newer versions no longer need.
At some point, we can probably simplify the generic builder, too.
enableShared in generic-builder.nix should default to what the GHC
compiler was compiled with. Add a passthru to all of the GHC compilers
to hold the value of enableShared. If enableShared is not set in the
GHC we just use false as the default value for enableSharedLibraries.
Note: I may have missed some compilers. Only GHC & GHCJS are covered
by this commit but this shouldn’t break evaluation of anything else.
This is needed for some cabal2nix stuff in getting the version.
Previously we had left out the version but apparently this can cause
problems in some scenarios.
/cc @elvishjerricco @peti @ericson2314