* Fix bzip2 static build for musl
* Enable static builds for xz/lzma
This is (currently) the same package on nixpkgs, so we make it the same
package here too.
For ghc 9.0.2 Haskell.nix will use the `stm`and `filepath` source that came with `ghc` when the version desired matches. This is because 9.0.2 shipped with packages that differ from the same version in hackage.
`reinstallableLibGhc` is fixed for GHC 8.10 and above. Rather than including a patch file this works by:
* Setting the `subDir` to the `compiler` directory when building. That way relative paths to other parts of the `ghc` source tree (outside the `compiler` directory) still work.
* Files that are needed, but generated when `ghc` builds are added from the `generated` output of the ghc derivation.
`nonReinstallablePkgs` is now sorted and deduplicated before it is used (this reduces the chance of rebuilds when the list is refactored).
When downloading a `repository` block we get a number of files (not just the index). For some repositories these files will be necessary for `cabal configure` and the vanilla ones created by haskell.nix will not work. This change keeps these extra files and combines them with the main hackage index using `lndir`, so that changes to the repo will not require a new copy of the hackage index in the store.
This change also introduces `inputMap` that allows flake or niv inputs to be used to pin repository. It also works with `source-repository-package` blocks.
When not on Windows, the `configureFlags` attr of `libmpc` is set to
`(drv.configureFlags or [])`. Since `drv.configureFlags` seems to be equal to
`["--enable-static" "--disable-shared"]` (at least on my machine),
`configureFlags` appears to be merged with itself and in the end, it is equal
to:
`["--enable-static" "--disable-shared" "--enable-static" "--disable-shared"]`.
You can verify this by comparing the derivations of `libmpc` with and without
this patch.
This changes the derivation of `libmpc` as well the derivation of all dependent
packages, like `gcc`, causing cache misses from https://cache.nixos.org/.
Because these packages are built and stored in the IOHK cache, users don't
notice this, until they use a different version of `nixpkgs` than the one pinned
by `haskell.nix`, e.g., one with a different version of `glibc` so that the IOHK
cache cannot be used. This results in `gcc` and other packages being built from
scratch instead of being downloaded from https://cache.nixos.org/.
Fix this by hoisting the conditional one level higher so that `overrideAttrs`
isn't even called on non-Windows OSes. Do the same for `mpfr` for consistency.
I haven't tested this on Windows. I'm not sure whether I have hoisted the
conditional too high, see the first comment in the file.
* Downgrades the error to a warning.
* Adds `filterPath` as a way to disable filtering to have caching work between Nix <2.4 and >=2.4.
* Disables filtering on `haskell-nix.hackage-project` based functions (should make all the GHC derivations the same).
I think it would also be possible to make a `filterPath` implementation that recursively used `builtins.readDir` and called the `filter` function to implement filtering on Nix <2.4, but I am not sure if it is worth it.
Anyone that needs the old behaviour for project packages (consistent filtering between <2.4 and >=2.4, but not between store and local) replace:
```
project = pkgs.haskell-nix.cabalProject {
src = pkgs.haskell-nix.haskellLib.cleanGit {
src = ./.;
};
};
```
```
project = pkgs.haskell-nix.cabalProject {
src = pkgs.haskell-nix.haskellLib.cleanGit {
src = {
outPath = ./.;
filterPath = { path, ... }@args:
if builtins.hasContext (toString path) then path else builtins.path args;
};
};
};
```
This is a better fix to the problem of making DLLs available to the process running in wine that is used to evaluate TH code when cross compiling for Windows.
Also fixes macOS loadArchive in TH for ghc 9
Co-authored-by: Michael Peyton Jones <michael.peyton-jones@iohk.io>
In recent nix, builtins.path works in restricted eval mode.
Therefore canCleanSource is not required anymore.
follow up on #1403
* add comment on hydra overlay
* throw error on outdated nix version
Currently we often get confusing errors (infinite loops looking for impossible materialization or GHC build errors) when trying to build a GHC version that is never going to work on the platform we are building for. In particular it is common to on M1 Macs to forget to include `--system x86_64-darwin` and wind up with a confusing error.
With this change the error is more clear:
```
hamish@Hamishs-MBP haskell.nix % nix-build -A pkgs-unstable.haskell-nix.compiler.ghc8105
error: Desired GHC (8.10.5) is older than the bootstrap GHC (8.10.7) for this platform (aarch64-apple-darwin).
```
`runCommandLocal` sets both `preferLocalBuild=true` and
`allowSubstitutes=false`. There's an
[argument](https://github.com/NixOS/nix/issues/4442) that the latter is a
misfeature. There's really no reason not to download something from a
substitutor if it's actually been built already.
We can get the effect that we want easily enough by just setting
`preferLocalBuild=true` alone.
* Improve support for external Hackage repositories
This change builds #535. `repository` blocks in `cabal.project` parsed and `cabal` is used to automatically downloaded them. Then `hackage-to-nix` is used to produce the nix required.
To make it work with restricted eval (on hydra for instance) we need to include a sha256 like this:
```
repository ghcjs-overlay
url: https://input-output-hk.github.io/hackage-overlay-ghcjs
secure: True
root-keys:
key-threshold: 0
--sha256: sha256-EPlLYPmIGtxeahlOspRzwJv+60N5mqrNC2BY4jZKceE=
```
To find the correct `sha256` put in an invalid one and attempt a build.
* Adds small address space logic
* no numa on android
* Update comp-builder.nix
* Adds android.nix
* host And target.
* Make android remote-iserv static
* Add back mmap_next
* Create rts-android-jemalloc-qemu.patch
* Update bootstrap.nix
* Some android modifications to ghc
* Some modifications to the android overlay.
* disable more hardening flags on android
* Adds stack-protector-symbols.patch
* Adds libraries-prim-os-android.patch
* Adds support for CONDBR relocations
* Adds undef+weak symbol support.
* calloc takes 3 not 2 args :-(
* Adds getauxval
* Needs enable static now
* Fix android cross
* patch out calls to mprotect with len=0 to stop qemu 6.0.0 from signalling ENOMEM
* widen scope of mprotect len=0 patch back to 8.10.1, when the mprotect call was introduced
Co-authored-by: Ross MacLeod <ross@vitalbio.com>
This reverts commit 9ccc486b9ff51e7f69c6420ded742a597be041fb.
Unfortunately our hydra is built against an old version of nix
which does not support this attribute.
* Use builtins.fetchGit{allRefs=true;} if no ref provided.
this allows to not being explicit about non-default branches.
* Pass buildProject as arg to first level project modules,
so that it can be used in, eg., shell definition.
* Add hsPkgs to projects modules config.
* Add benchmarks to generated project.flake packages
Nix's assert statements reproduce the assertion almost verbatim in an
error message, this makes for fairly inscrutable errors. I've tried here
to improve the error message by introducing local names (these could
create some confusion because of shadowing if similar names are
introduced in another scope later) and adding a trace messages using
`lib.assertMsg`.
Fixes#1249