Commit Graph

14 Commits

Author SHA1 Message Date
Hamish Mackenzie
c2f14344f1
Add ghc 9.2.4 (#1566) 2022-07-31 21:41:50 +12:00
Hamish Mackenzie
a443611ecf
Add evalSystem and evalPackages project args (#1546)
This adds a way to specify the `evalSystem` or `evalPackages` explicitly when calling the `project` functions.

Currently if we want to make a `flake` that supports multiple systems we have few options:

* Require builders for all the supported systems (even just for `nix flake show`).

* Pass `--impure` so that haskell.nix can see `builtins.currentSystem` to set up `pkgs.evalPackages` to use that.  Unfortunately this prevents nix from caching some of the work it does and often results in it recalculating for each supported system when it would otherwise be cached and take no time at all.

* Add an overlay to replace `evalPackages`.  This works, but it is not straight forward.

* Materialize the nix files for the project.

This change allows `evalSystem = "x86_64-linux";` to be passed telling `haskell.nix` to run `cabal` and `nix-tools` on that system.  The user will have to have a builder for that system, but does not need to have builders for the others (unless building outputs for them).
2022-07-28 20:03:05 +12:00
Hamish Mackenzie
fa2fa131fe
Add ghc 9.2.3 (#1491)
Also:

* Updates the GHC's built on CI
* Use Cabal 3.6.2.0 for default Setup
* Fixes haskell-language-server and hlint on CI
2022-06-01 19:33:58 +12:00
Hamish Mackenzie
fa2d8a9b6f
Add ghc 9.2.2 (#1394) 2022-03-08 14:34:04 +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
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
Hamish Mackenzie
9ce7bf1e02
GHCJS 8.10 (#1082) 2021-03-29 22:36:47 +13:00
Hamish Mackenzie
a59be5c421
Add GHC 9.0.1 (#1032)
Also refactors the way tests are filtered to use `meta.disabled` where possible.
2021-03-28 21:03:20 +13:00
Hamish Mackenzie
5c25ce919f
Add getComponent to project and package (#1060)
* Delays cabal configure errors until after evaluation when possible.

* Avoids rerunning long `cabal configure` if we already know it will fail.

* Provides a way to get a component from a package or project using a `cabal` like reference.

Code using the `tool` functions will automatically use `getComponent`.

For `(hackage-package {...}).components.library` is also ok.

```
# Consider changing hackage-package use:
(pkgs.haskell-nix.hackage-package {...}).components.exes.something
(pkgs.haskell-nix.hackage-package {...}).getComponent "exe:something"

# For any cabal project:
project.hsPkgs.somepackage.components.exes.something
project.getComponent "somepackage:exe:something"
# or do it in two steps
(project.getPackage "somepackage").getComponent "exe:something"
```

The reason for the new function is that we cannot provide the attribute interface without knowing that packages are in the project first.

Here is how the `cabal configure` error output is handled:

* The `plan-nix` derivation builds even if `cabal configure` fails.

* When it fails, it copies `failed-cabal-configure.nix` to the `$out/default.nix` along with a copy of the `cabal configure` output.

* When `failed-cabal-configure.nix` is imported and used in any way it writes the `cabal configure` output with `__trace` so it will always be visible.

* Instead of a `plan` the imported nix contains a `configurationError` pointing the `cabal configure` output.

* The intermediate functions `configurationError` and bubble it up to where it is needed.

* `getPackage` returns a mostly empty proxy for a real package when there is a `configurationError`

* The `getComponent` function always returns a derivation, but the version in the proxy writes the `cabal configure` output to stdout and calls `exit 1` (so that it will never build).
2021-03-04 20:10:58 +13:00
Hamish Mackenzie
89f50a96dd
Use pkgs.lib instead of stdenv.lib (#1031)
Fixes:

Warning: `stdenv.lib` is deprecated and will be removed in the next release. Please use `pkgs.lib` instead. For more information see https://github.com/NixOS/nixpkgs/issues/108938
2021-02-11 01:07:16 +13:00
Silvan Mosberger
feea345b32
Throw better error when conf files are missing (#1030)
* Throw better error when conf files are missing

Previously, if some directories were missing .conf files, an error like
this would be thrown:

  cp: missing destination file operand after '/nix/store/pnmrz06g0sa4s3yx53hgmr9k8jrh6ww0-ouroboros-network-framework-lib-ouroboros-network-framework-0.1.0.0-haddock-config/lib/ghc-8.6.5/package.conf.d'

While normally this shouldn't occur, I've seen it happen in CI anyways,
with the problem disappearing if the store path that's missing the files
was rebuilt a couple times.

With this commit, it becomes much easier to figure out which store path
is missing the files, which would be very hard to figure out from the
previous message.
2021-02-08 03:13:31 +13:00
Hamish Mackenzie
6134e66e1d
Fix ghc 8.10 windows cross (boot with 8.6.5) (#865)
It looks like we can't use 8.8 for booting due to
https://gitlab.haskell.org/ghc/ghc/-/issues/18143

* Adds nixpkgs 20.09 to get mingw-w64 version 6
  (also needed for ghc 8.10 windows cross compile)

* Add materialization for ghc 8.10.2 windows cross

* Fix issue with harfbuzz override so it works with nixpkgs 20.09

* Fixes eval time issue for windows index-state test (turns off native-dns cabal flag for windows)

* Include exe extension for windows in coverage test

lib:ghc is still broken for ghc 8.10 (all variants), but it always has been and we should try to fix it properly, but it will be very tricky.
2020-10-07 15:42:32 +13:00
Hamish Mackenzie
4cac8bd00f
Remove internal deps on default ghc and stackage (#738)
Changes to the interface of haskell.nix (from the changelog.md file):

* Removed `sources.nixpkgs-default`, use `sources.nixpkgs` instead.
* Removed `./nixpkgs` directory, use  `(import ./. {}).sources`
  or `./nix/sources.nix` instead.
* Removes V1 interface for details on how to fix old code see:
    https://github.com/input-output-hk/haskell.nix/issues/709
* Removed defaultCompilerNixName.
* cabalProject, cabalProject', hackage-project and hackage-package
  now require a `compiler-nix-name` argument.
* `haskell-nix.tool` and `.tools` now require a `compiler-nix-name` argument.
  New functions `p.tool` and `p.tools` (where p is a project) do not.
  Like `shellFor { tools = ... }` they will use the compiler nix name
  from the project (including stack projects where it is derived from
  the resolver).
* `haskell-nix.alex` and `haskell-nix.happy` have been removed. Use
  `p.tool "alex" "3.2.5"` or `shellFor { tools = { alex = "3.2.5"; } }`.
* `haskell-nix.nix-tools` -> `haskell-nix.nix-tools.ghc883` (it includes
  the hpack exe now).
* `haskell-nix.cabal-install` -> 
  `p.tool "cabal" "3.2.0.0"` or `shellFor { tools = { cabal = "3.2.0.0"; } }`
* `haskell-nix.haskellNixRoots` -> `haskell-nix.roots ghc883` or `p.roots`

Other changes:

Adds hpack executable to the nix-tools derivations.

Adds a `cabal-hpack` test to make sure `hpack` works with
`cabalProject`.

Reduces the number of calls to `cabalProject` (particularly when
checking materialization), by giving internal tools a per-compiler
attribute.

Uses happy 1.19.12 when building newer ghc versions.

Updates cabal-install 3.2.0.0 to use the source from github that
is compatible with ghc 8.10.1.

Updates the docs for callCabalProjectToNix.

Adds a license mapping to fix a common warning.
2020-07-08 22:54:01 +12:00
Hamish Mackenzie
dcadfa8ab4
Use suitable hackage state for index-state (#673)
Fixes #672 by using the first index-state that is > than desired
index state.  It also passes `--index-state` to `cabal v2-cconfigre`
to make sure it cabal uses only the packages in the hackage
file that are before the specified date.

Fixes #540 by returning the `index-state` used back out of
`cabalProject` in the same way `plan-nix` is returned.
2020-06-13 01:03:17 +12:00