Commit Graph

246 Commits

Author SHA1 Message Date
Shea Levy
d82e4c0e24
Merge branch 'external-static-8.10.4'
Add external static plugins patch to Plutus GHC
2022-05-03 13:38:16 -04:00
Hamish Mackenzie
60919c5cc1
Possible fix for nix 2.4 issue (#1461) 2022-05-03 21:06:26 +12:00
Luis Pedro Coelho
c6a5afba7e
Build bzip2 & xz with static libs in musl crossPkgs (#1456)
* 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.
2022-04-28 10:13:42 +01:00
Shea Levy
2fd79406fe
Add external static plugins patch to Plutus GHC 2022-04-25 00:47:51 -04:00
Hamish Mackenzie
f3ea06dcac
Work around for packages in lts that do not install. (#1437)
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).
2022-04-20 15:25:21 +12:00
Hamish Mackenzie
e81f3bb011
Avoid filtering repo to just 01-index.tar.gz file (#1432)
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.
2022-04-14 02:35:37 +12:00
Hamish Mackenzie
8a32c395cb
Fix ghc-lib-parsrer for stackage (#1436) 2022-04-12 14:35:42 +12:00
Thomas Winant
0c9142a753
Don't duplicate the configureFlags when not on Windows (#1420)
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.
2022-04-07 21:59:32 +12:00
Hamish Mackenzie
8eb5d29d37
Support Nix <2.4 (#1418)
* 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;
     };
  };
};
```
2022-03-29 01:24:01 +13:00
Hamish Mackenzie
4b6ee9767d
Make DLLs in deps available to wine TH runner (#1405)
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>
2022-03-25 21:44:02 +13:00
DavHau
a385241331
Remove canCleanSource (#1409)
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
2022-03-25 12:57:36 +13:00
Jean-Baptiste Giraudeau
53ffd8eac6
Enable static build of secp256k1 on musl (#1413) 2022-03-22 14:56:27 +00:00
Hamish Mackenzie
a4da3fa890
Better error when GHC is too old to build (#1411)
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).
```
2022-03-22 11:59:45 +00:00
DavHau
1ca99326b2
always clean the source, no matter what (#1403)
* always clean the source, no matter what

* update hydra
2022-03-19 02:08:11 +13:00
Hamish Mackenzie
eb49a3b721
Add secp256k1 DLL for win cross compilation of TH (#1400) 2022-03-15 16:33:49 +13:00
Viktor Kronvall
185dc162b3
configureFlags must be a list in newer nixpkgs (#1396) 2022-03-12 19:45:59 +13:00
Hamish Mackenzie
fa2d8a9b6f
Add ghc 9.2.2 (#1394) 2022-03-08 14:34:04 +13:00
Hamish Mackenzie
7e06e14ae1
Use ghc 8.8.3 to boot native aarch64-linux compiler (#1390)
For some reason there is no binary for 8.8.4 see:

https://downloads.haskell.org/ghc/8.8.3/
https://downloads.haskell.org/ghc/8.8.4/
2022-03-03 16:33:04 +13:00
Michael Peyton Jones
315b6d353d
Don't use allowSubstitutes=false (#1389)
`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.
2022-03-03 15:17:42 +13:00
Hamish Mackenzie
2576a948b5
Improve support for external Hackage repositories (#1370)
* 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.
2022-02-18 00:42:11 +13:00
Peter Becich
c4713f624f
update GHC used for aarch64 bootstrap (#1325) 2022-02-15 11:13:51 +13:00
Hamish Mackenzie
f67cf8e439
Use updated nix-tools (#1365) 2022-02-09 22:08:43 +13:00
Teo Camarasu
b48b549c96
musl: allow linking pcre statically (#1363) 2022-02-04 15:24:07 +00:00
Moritz Angermann
eb7e669d63
Enable aarch64 builds (#1316)
* 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
2022-01-09 11:36:53 +13:00
Moritz Angermann
001df758bf
fix ghcjs (#1311) 2022-01-09 03:11:37 +13:00
Hamish Mackenzie
6101c6ea7b
Add GHC 9.0.2 (#1338)
Co-authored-by: Ollie Charles <ollie@ocharles.org.uk>
2022-01-09 03:10:05 +13:00
Javier Sagredo
0e2ae928e2
Rename executable-profiling flag as suggested by Cabal (#1136) 2021-12-27 15:28:59 +08:00
Peter Becich
9009a48f29
Patch for https://gitlab.haskell.org/ghc/ghc/-/issues/18708 by author @sgraf812 (#1321)
Backported to potential GHC 8.10.8 here: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/6554
2021-12-27 15:23:05 +08:00
Hamish Mackenzie
64cd5f70ce
Fix for emscripten (#1294) 2021-11-17 11:19:52 +13:00
Moritz Angermann
59ad2995cc
Update ghcjs810-src.json (#1291)
* Update ghcjs810-src.json

* Update ghcjs-project.nix

* Update ghcjs.nix

Use nodejs-12_x, to allow larger strings to be loaded. See https://github.com/nodejs/node/issues/33960

* Update comp-builder.nix

Allow large strings, see https://github.com/nodejs/node/issues/33960

* Update cabal-os-arch-comp.nix

* Update ghcjs-src

* Update ghcjs ref

Co-authored-by: Hamish Mackenzie <Hamish.K.Mackenzie@gmail.com>
2021-11-17 02:17:02 +13:00
Teo Camarasu
8ed2bf2cdb
add patches with non-moving gc fixes for 8.10 (#1290) 2021-11-14 08:15:03 +08:00
Hamish Mackenzie
24b421cbfc
Add ghc 9.2.1 and update internal cabal to 3.6.2 (#1286) 2021-11-13 12:43:04 +13:00
Ross MacLeod
aaf4e230c6
patch out calls to mprotect with len=0 to stop qemu 6.0.0 from signalling ENOMEM (#1289)
* 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>
2021-11-12 15:30:01 +08:00
Jean-Baptiste Giraudeau
13164ac0d8
Revert "Use builtins.fetchGit{allRefs=true;} if no ref provided." (#1274)
This reverts commit 9ccc486b9ff51e7f69c6420ded742a597be041fb.

Unfortunately our hydra is built against an old version of nix
which does not support this attribute.
2021-10-22 18:27:20 +02:00
Hamish Mackenzie
a32cbbd188
s/benchmarks/bench/ consistent with ctype from cabal (#1273) 2021-10-22 14:35:00 +13:00
Jean-Baptiste Giraudeau
1205c42154
Some smalls improvements (#1271)
* 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
2021-10-22 14:23:48 +13:00
toonn
cd9beb4ef5
haskell.nix: Improve compiler version mismatch error (#1269)
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
2021-10-18 14:06:31 +13:00
JackKelly-Bellroy
2b2745b9b0
musl: override zstd to link statically (#1267) 2021-10-12 13:53:11 +01:00
Hamish Mackenzie
f8d4795cfe
Update ghcjsVersion to match cabal file (#1266)
* Update ghcjsVersion to match cabal file

* Update materialized files

* Update materialized files
2021-10-12 13:28:42 +13:00
Hamish Mackenzie
2b5ad5aced
Add project.buildProject (#1265)
* Add project.buildProject

This exposes the project used by `buildModules`.

* Update overlays/haskell.nix

Co-authored-by: Jean-Baptiste Giraudeau <jean-baptiste.giraudeau@iohk.io>

* Update overlays/haskell.nix

Co-authored-by: Jean-Baptiste Giraudeau <jean-baptiste.giraudeau@iohk.io>

* Fix syntax error

Co-authored-by: Jean-Baptiste Giraudeau <jean-baptiste.giraudeau@iohk.io>
2021-10-11 23:38:09 +13:00
Jean-Baptiste Giraudeau
56f22053e6
Flake: add checks for crossPlatforms. (#1259) 2021-10-06 00:58:31 +13:00
Jean-Baptiste Giraudeau
280ec975e1
Eval pkg-set with a correct buildModules arg (#1258)
issued from from top-level modules evaluation.
 Otherwise `buildModules` can be wrong, failing to correctly evaluate
 modules that can change pkg-set, like:
 ```
{pkgs, ... }: {
  cabalProjectLocal = optionalString pkgs.stdenv.hostPlatform.isWindows ''
    constraints: Win32 ==2.6.1.0, mintty ==0.1.2
  '';
}
```
2021-10-05 23:53:47 +13:00
Hamish Mackenzie
4e8acd3400
Fix issue when mfpr is not in nixpkgs (#1253) 2021-09-28 22:36:02 +13:00
Jean-Baptiste Giraudeau
749a7dc068
Add appendModule function to projects. (#1240)
Allow re-eval of the project with an extra module (or module list).
2021-09-18 14:43:46 +12:00
Hamish Mackenzie
ae5ff8525f
Remove workaround for hls (#1237)
Not needed now ghc-api-compat has been updated in hackage
2021-09-14 15:54:36 +12:00
Hamish Mackenzie
e2f77a9873
Fix evalPackages for flakes that are cross compiling (#1234) 2021-09-10 16:40:37 +12:00
Hamish Mackenzie
f3b109b2fb
Add aarch64-darwin support (#1230) 2021-09-07 22:22:01 +12:00
Hamish Mackenzie
c0b2ad7292
Remove work around for hlint issue (#1221)
See https://github.com/ndmitchell/hlint/issues/1287
2021-09-02 18:00:28 +12:00
Hamish Mackenzie
1f4c2c9b08
Add GHC 8.10.7 (#1220) 2021-09-01 22:43:31 +12:00
Hamish Mackenzie
58dff9550b
Update some older GHC materialization files (#1222) 2021-09-01 20:21:30 +12:00