Commit Graph

25 Commits

Author SHA1 Message Date
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
1f4c2c9b08
Add GHC 8.10.7 (#1220) 2021-09-01 22:43:31 +12:00
Teo Camarasu
f624ca5662
Add GHC-8.10.6 (#1214)
Add GHC-8.10.6

Co-authored-by: Peter Becich <peter@simspace.com>
Co-authored-by: Teo Camarasu <teofilcamarasu@gmail.com>
Co-authored-by: Hamish Mackenzie <Hamish.K.Mackenzie@gmail.com>
2021-08-31 04:19:40 +12:00
Hamish Mackenzie
674f5b0a3d
Better support for source-repository-packages, only include planned components and pick latest packages (#1166)
This change updates to the latest `nix-tools` to get the following fixes (there are 3 PRs in nix-tools, but just the one in haskell.nix to avoid having to update the materialized files multiple times):

## Better support for source repository packages

* https://github.com/input-output-hk/nix-tools/pull/107

Currently these are replaced by the `cabalProject` functions with regular `packages:` before running cabal configure.  Cabal does not treat these the same (the setting of `tests:` and `benchmarks:` in the `cabal.project` file):

* The plan found by `cabalProject` may not match the one used when running `cabal`.
* The performance of the solver may not be consistent with running `cabal`.

This change replaces `source-repository-package` with another `source-repository-package` pointing at a minimal git repo.

## Only include planned components

* https://github.com/input-output-hk/nix-tools/pull/108

Only the components in the `plan.json` are now included in the haskell.nix cabal projects.  This avoids missing dependencies attempting to build components that were not in the plan.  Should fix #993.

## Pick latest packages

* https://github.com/input-output-hk/nix-tools/pull/109

When the same package occurs more than once in a `plan.json` file (perhaps because it is needed both by the project itself and by one of the `setup` dependencies or `build-tool-dependencies` of the project) the latest version will now be the one picked by haskell.nix. This is a work around for a common issue with `cabal-doctest` when cross compiling to windows (an old version of Win32 is used even if a newer one was required by the projects `constraints`).
2021-07-23 14:27:56 +12:00
Hamish Mackenzie
a5b74bf002
niv update nixpkgs-unstable and add ghc 8.10.5 (#1121) 2021-06-15 19:50:45 +12: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
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
Hamish Mackenzie
2b7d93baf6
Allow package-name:sublib-name in build-depends (#963)
With cabal 3 it should be possible to reference a sublib in the
`build-depends` of a `.cabal` file using `package-name:sublib-name`

The `cabal-sublib` test is updated to include the new type syntax
and a fix is included for the component builder.

We will need to update `plan-to-nix` in `nix-tools` as well.
For now the work around is to use a module to add the sublib to
`depends` (see `test/cabal-sublib/default.nix`).

Without this fix the `cabal-sublib:slib` was not found by
`setup configure` because only `--dependency=slib=cabal-sublib-...`
was passed.  The fix is to also pass
`--dependency=cabal-sublib:slib=cabal-sublib-...`.
2021-01-08 23:11:16 +13:00
Michael Peyton Jones
f6bc2f7315
Better 'required' job that includes everything (#976)
This requires explicitly identifying the things tht don't work and
removing them. I used our own `disabled` attribute, because `broken` is
weird and breaks evaluation, which isn't really what we want.

Cuts the number of jobs from over 2000 to 216. This seems to greatly
speeds up the time it takes small changes (where most stuff remains the
same) to be processed by hydra.

Uses https://github.com/NixOS/hydra/issues/715 to reference the
jobs in required by name avoiding OOM issues.

Co-authored-by: Hamish Mackenzie <Hamish.Mackenzie@iohk.io>
2021-01-06 16:44:43 +13:00
Hamish Mackenzie
7078b145e9
Add support for ghcjs 8.8 and making ghcjs bundles (#828)
Fixes ghcjs 8.6.5 and 8.8.4.

Uses emscripten for ghcjs 8.8 and adds scripts for building ghcjs 8.8.

Many fixes for ghcjs test failures.

Includes relocatableConfigFiles for making relocatable ghcjs bundles.
2020-11-17 22:22:53 +13:00
John A. Lotoski
09526c8555
Spelling, typo and whitespace fixes (#833)
* Spelling and typo fixes in doc and code comments
* Trailing whitespace or whitespace only truncation
* readTheDocs formatting corrections
2020-08-31 11:08:25 +12: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
d1102d342c
Add pins and materialization for ghc-boot-packages and ghc-extra-packages (#546)
* Include `tests` in path for cross compiled tests

* Add ghc-boot-packages-nix to haskellNixRoots

* Fix naming warnings in tests sources

* Uses a single cleanGit call for all the tests

* Add memoize code for ghc-boot and ghc-extra pkgs

* Memoize ghc-boot and ghc-extra pkgs nix

* Fix release.nix being more strict than ci.nix by updating filterAttrsOnlyRecursive in ci-lib.nix

* Nicer errors when materialized path does not exist

* Updated materialization docs

* Add internalHackageIndexState to set the index-state used within haskell.nix
2020-04-20 13:27:52 +12:00
Hamish Mackenzie
775c8cf756
Fix cross compilation issues for musl and aarch64 (#322)
* Enables tests for Musl and AArch64 (also rasbery pi, but leaves them disabled for now) and includes many fixes for the tests that were broken.

* Makes Musl cross compiler more like native (including making `ghci` and `runghc` work)

* Updates selection of enableShared

* Works around missing configFiles attribute issue

* Use ghc-extra-packages and compiler.nix-name to pick the right extra packages

* Leaves out --cross-compile on hsc2hs for musl

* Fixes haddock and hoogle for musl and disables them for other cross compilers

* Adds ghc 8.8.3

* Static link components (except libraries and `all`) on musl

* Use qemu for the arm cross compile `testWrapper`

* Add isCrossHost and isCrossTarget functions

* Fixes profiling on AArch64

* Disable split sections when compiling for windows (fixes GHC 8.8 cross compile to windows)

* Disable hoogle in cross compiler shells for now
2020-03-04 16:07:01 +13:00
Hamish Mackenzie
79c2c631c3
Run the cross compiled tests on wine (#317)
Changes to the haskell.nix code to fix broken tests:

* Add missing `then` to `call-cabal-project-to-nix.nix`.

* Fix default `hsSourceDirs` so that `.` gets included for `.all` component if one of the components does not have a `hsSourceDir` set.

* Fix `haskellNixRoots` so it works when cross compiling to windows.

Improvements to the haskell.nix tests:

* Run haskell.nix tests of nixpkgs 19.03 and 19.09.

* Run haskell.nix tests cross compiled to Windows under Wine (when possible).

* Add nix used as IFD inputs as tests to ensure they are cached.

* Use `haskell-nix.cabal-install` instead of `nixpkgs.cabal-install` in tests.
2019-11-20 13:47:15 +13:00
Rodney Lorrimar
686fa37877
shellFor: Fix bug where packages were not excluded from the env (#285)
* tests: Add regression test for shellFor build-tools bug

* tests: Fix regen script

* Regenerate nix expressions for tests

* tests: ghc 8.4.4 -> 8.6.5

* shellFor: Fix bug where packages were not excluded from the env

If a multi-package project had an build-tools dependency between
packages, they would not be correctly removed from the shell's inputs.
2019-11-01 20:08:31 +10:00
Rodney Lorrimar
b47a6bb1a2 shellFor: Use CABAL_CONFIG only with exactDeps = true (#255)
* shellFor: Use CABAL_CONFIG only with exactDeps = true

* shells: Put write-ghc-environment-files: never in cabal.config
2019-10-13 19:43:17 +08:00
Rodney Lorrimar
53c0498ec4 Add tests for benchmarks and hspec-discover (#181)
* tests: Add benchmarks and hspec-discover to cabal-22 test
2019-10-01 10:01:49 +08:00
Hamish Mackenzie
fdcb2da2a8
Add default for shellFor packages (#242)
Uses the `isLocal` for property set by `plan-to-nix` and `stack-to-nix`
on packages where the source is referenced in the `cabal.project`
or `stack.yaml` file.
2019-10-01 11:10:11 +13:00
Hamish Mackenzie
efab350c0f Fix setup-depends dependencies (#124)
* Use setup-depends from nix-tools output

* Use `-package ghc` when building Setup.hs

* Include --package-db when building Setup

* Fix for tests on case insensitive FS (macOS)

The file `conduit.hs` looks like `Conduit.hs` to ghc and it uses it
by mistake for `import Conduit`.
2019-07-12 21:48:13 +08:00
Rodney Lorrimar
3bb58214f1
Add cross-compiled musl libc builds of tests (#157)
* Add cross-compiled musl libc builds of tests

* Bump nixpkgs to latest 19.03

* tests: Update stack-simple LTS

* docs: Add note about tests

* Regenerate tests

* haskellPackages: lts-13.18 -> lts-13.26

This contains GHC 8.6.5 which can successfully build under
pkgsCross.musl64, whereas GHC 8.6.4 could not.

* Bump nix-tools

* Regenerate nix-tools -- changed compiler from GHC 8.6.4 -> GHC 8.6.5.
2019-07-02 18:25:40 +10:00
Jean-Baptiste Giraudeau
3fb220334f
Fix name of shellFor derivation for a single package. (#155) 2019-05-30 22:46:39 +02:00
Rodney Lorrimar
e6b07b482b
tests: Generated nix for cabal new-build project 2019-05-28 09:35:00 +10:00
Rodney Lorrimar
dd1baeb287
tests: Add a cabal new-build project 2019-05-28 09:35:00 +10:00
Rodney Lorrimar
b060ea5576
tests: Add tests for the shellFor function 2019-05-28 09:34:58 +10:00