Commit Graph

122 Commits

Author SHA1 Message Date
Kobayashi
4e100b2ad9
enable internal-interpreter flag for ghc (#1536) 2022-07-02 21:07:09 +12:00
Andrea Ciceri
2c1701b681
Supporting ca-derivations experimental feature (#1494)
* Supporting `ca-derivations` experimental feature

* Improved `contentAddressed.include` option description

* Ensure deterministic output for content addressed components

* Comment transformed into a Nix comment

To avoid possibly useless rebuilds

* Use `modules` arg `contentAddressed` flag

* Tutorial about CA derivations

Co-authored-by: Hamish Mackenzie <Hamish.K.Mackenzie@gmail.com>
2022-06-23 12:39:35 +12:00
Hamish Mackenzie
2a89c68994
Build ghci/ghc with internal interpreter (#1520)
Fixes #1512
2022-06-22 16:00:58 +12:00
Hamish Mackenzie
d3ba497b5f
Fixes to help building of all packages in stackage (#1503)
These are the less controversial changes from #1251
2022-06-02 22:45:09 +12:00
Hamish Mackenzie
4b61024e55
Fix for ghc-lib-parser 9.2 and haskell.nix patched ghc (#1502)
Fixes #1488
2022-06-02 15:00:54 +12:00
Hamish Mackenzie
95faec6038
Default reinstallableLibGhc to true (#1498)
It fixes more things than it breaks now.
2022-06-02 13:21:12 +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
Travis Whitaker
449d80f722
default enableSeparateDataOutput to true (#1476) 2022-05-25 00:18:33 +12:00
Hamish Mackenzie
82bc945818
Fix ghc 9 windows cross compilation (#1450)
Fixes Windows cross compilation for GHC 9.0 and 9.2.

Updates wine to use the version that is included with the chosen Nixpkgs (it used to be pinned to an older version).

Moves the configuration of the GHC source into the GHC derivation.  This should make adding Hadrian support easier.

Propagates library dependences (not just pkgconfig ones) on windows so that any DLLs in those libraries can be copied for TH evaluation and to the `/bin` directory of executable components.

Adds gcc and mfcgthreads as library dependencies on Windows so that the DLLs they include will be found.

Use `$pkgsHostTarget` (instead of `ghc-pkg`) to find all the DLLs can copy them to the `/bin` directory of executable components.

Adds support for __int128_t and __uint128_t to language-c to fix aarch64-darwin builds.

Fixed reinstalling packages that come with patched versions in ghcjs.
2022-05-19 20:21:16 +12:00
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
0a847d9ab9
Fix ghcide 1.7 and ghc810420210212 (#1462) 2022-05-03 21:07:31 +12:00
Shea Levy
bfeea3e894
Allow packages to specify external static plugins 2022-05-02 11:08:42 -04:00
Hamish Mackenzie
f707aa2e75
Fix hls conflict with unboxed tuple (#1457)
This is Maxim Koltsov's work around for building `haskell-language-server` with the haskell.nix compilers that include unboxed tuple patch.

See https://github.com/haskell/haskell-language-server/issues/2860#issuecomment-1110861573
2022-04-29 01:13:56 +12: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
fa2d8a9b6f
Add ghc 9.2.2 (#1394) 2022-03-08 14:34:04 +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
Hamish Mackenzie
f67cf8e439
Use updated nix-tools (#1365) 2022-02-09 22:08:43 +13:00
Shea Levy
50fd86f249
call-cabal-project-to-nix: Allow overriding source-repository-package entries. (#1354) 2022-01-27 08:27:22 +08: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
Tom Prince
a68a7dda41
Add nixos-21.11 builds. (#1304)
* Add nixos-21.11 builds.

* Remove references to nixpkgs-20.09.
2021-12-07 12:55:20 +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
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
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
3835023cda
Add package.buildable option (#1205)
* Add `package.buildable` option

Turning off building for a whole package requires setting `buildable = lib.mkForce false` on each of the components of the package.  This change adds support for `package.buildable = false` to make it easier.

So:

```
packages.marlowe-actus.components.library.buildable = lib.mkForce false;
packages.marlowe-actus.components.exes.marlowe-actus-test-kit.buildable = lib.mkForce false;
packages.marlowe-actus.components.tests.marlowe-actus-test.buildable = lib.mkForce false;
```

Can be replaced with:

```
packages.marlowe-actus.package.buildable = false;
```
2021-08-19 00:52:59 +12:00
Hamish Mackenzie
f8a0b92bc3
Add patches speeding up cabal build-tool-depends (#1200)
* Add patches speeding up cabal build-tool-depends

* Add missing brackets and fix paths

* Fix up patches for 3.4

* Fix missing file from patch

* Add comments
2021-08-14 12:05:58 +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
6b28399864
Add Hix wrappers for Nix tools (#1053)
The `hix` tools are wrappers for the various `nix` tools that
use `haskell.nix` without the need to add any `.nix` files.

This is useful for:

* A quick way to try out haskell.nix for new users.

* Using haskell.nix to work on projects that do not have
  `.nix` files.

* Testing to see if `haskell.nix` can build a project.

* Making `flake` and `non flake` configurations to check `haskell.nix`
  treats them the same.

The configuration arguments for `Hix` can be (from highest precedence to lowest):

* Passed on the command line with `--arg` (or `--argstr` for string args).

* Placed in `nix/hix.nix` file in the project dir.

* Placed in `~/.config/hix/hix.conf`

Boilerplate `default.nix`, `shell.nix` and `flake.nix` files can be added to a
a project with a `nix/hix.nix` file to make it work with the standard `Nix`
tools.
2021-06-26 17:58:06 +12:00
Hamish Mackenzie
f279cdef5f
Update the project modules and fix missing args param (#1144)
There are now 4 project modules used to check the arguments passed to the various project functions:

* `project-common.nix` - Arguments used by all the project functions
* `stack-project.nix` - Used by the `stackProject` and `stackProject'` functions
* `cabal-project.nix` - Used by the `cabalProject` and `cabalProject'` functions
* `project.nix` - Just the `projectFileName` argument that is used by `project` and `project'` functions to determine whether to call `stackProject` or `cabalProject` function.

This also includes the `rawProject.args` that was mistakenly left out of #1141 causing #1142 and improvements for the docs for the use of the `shell` argument in `flake.nix` files.
2021-06-20 18:00:22 +12:00
Ollie Charles
37b9ce1670
Add writeHieFiles (#1022)
* Bump nix-tools to latest master revision

* Add writeHieFiles

* Update modules/plan.nix

Co-authored-by: Michael Peyton Jones <me@michaelpj.com>

* Move where the hie flags are specified

Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
2021-06-18 20:25:19 +12:00
Hamish Mackenzie
c3841b4208
Add cross compilation and devShell to project.flake (#1141)
The default shell `devShell` works by adding a default `shell` to all projects.  You can pass the shell arguments to the project function using the new `shell` argument:

```
let myProject = haskell-nix.project {
  src = ./.;
  shell.tools = { cabal = {}; };
  shell.crossPlatforms = p: [ p.cross ];
};
```

This will include js-unknown-ghcjs-cabal in the `devShell`.

To add cross compiled outputs to the flake pass `crossPlatforms` to the `flake` function.

```
myProject.flake { crossPlatforms = p: [ p.cross ]; }
```

To cross compile a component include the platforms `config` string to the output name like this

```
nix build .#js-unknown-ghcjs:pkg-name:lib:pkg-name
```
2021-06-17 19:07:37 +12:00
Hamish Mackenzie
4f449d37f5
Use nix module system to check project arguments (#1087)
* Use nix module system to check project arguments

This change uses the nix module system for the arguments to:

* `cabalProject'`
* `cabalProject`
* `stackProject'`
* `stackProject`

This will:

* Give an error when the name or type of an argument is incorrect
  (currently misnamed args are quietly ignored).

* Fixes a problem with `projectCross` not having a way to pass different args to `cabalProject`
  for different platforms. We can now use:
    `({pkgs, ...}: { cabalProjectLocal = if pkgs.stdenv.hostPlatform.isX then ... })`
2021-04-08 12:06:26 +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
Dennis Gosnell
6c627b429b
support cabal-doctest (#427)
* Add test.

* wip

* Fix merge regression

* Combine drv, drv.source and drv.dist for doctest

* Skip cabal-doctests test when cross compiling

* Add the --no-magic flag to the .cabal file for the cabal-doctests test.

This appears to be necessary on OSX.

The --no-magic flag stops the doctest executable from expanding path
arguments, trying to locate the package db, etc.

This shouldn't be necessary with cabal-doctest, since all the
necessary options to pass to doctest are computed when running the Setup.hs
script.

See
https://github.com/input-output-hk/haskell.nix/pull/427#issuecomment-605761780.

* Fix cabal-doctest support

* Skip cabal-doctest test plan cross compiling

* More fixes for cabal-doctest

* Skip cabal-doctest tests when cross compiling

Co-authored-by: Moritz Angermann <moritz.angermann@gmail.com>
Co-authored-by: Hamish Mackenzie <Hamish.Mackenzie@iohk.io>
Co-authored-by: Hamish Mackenzie <Hamish.K.Mackenzie@gmail.com>
2021-03-20 14:25:30 +13:00
Hamish Mackenzie
42b10678ff
Add support for setting ghcOptions on all packages (#1046)
`ghcOptions` has been moved from package and is now a list of strings.
    old: packages.x.package.ghcOptions = "someGHCoption";
    new: packages.x.ghcOptions = ["someGHCoption"];
To specify ghcOptions for all packages:
    ghcOptions = ["someGHCoption"];
For a single component:
    packages.x.compoents.library.ghcOptions = ["someGHCoption"];
2021-02-19 00:38:36 +13:00
Hamish Mackenzie
f056dd34cd
Fix the way ExeDependency is handled (#1036)
See https://github.com/input-output-hk/nix-tools/pull/101

We should look up hsPkgs.${pkg-name}.components.exe.${component-name}
instead of including the package as a dependency.

Adding `hsPkgs.${pkg-name}` a tool it is not clear which executable in the package `haskell.nix` should choose.

Haskell.nix did not deal with this well and in fact it could lead to `nix-shell` crashing.  For instance using `shellFor` to make a shell for building `haskell-language-server` with `cabal build` crashed as a dependency on `ghcide` the executable (by the `ghcide-bench` executable) caused infinite recursion.  Allowing `ghcide-bench` to correctly depend just on `components.exes.ghcide` fixes this.

This PR also includes:

* Updated materialized files built with the new nix-tools and latest index-state
* Small update to GHCJS (pins happy) to fix issue that showed up when the materialization was updated
* A fix for the infinite recursion issue when updating materialized files (by adding ghc-boot-packages-unchecked).
* Performance fix for shellFor (checks just the names of component derivations when filtering).
2021-02-12 10:45:23 +13:00
Michael Peyton Jones
8455f75c8c
Use configuration-nix to include freetds dependency of the odbc package (#1000)
I think this is more correct: other package that depend on the system
odbc package may not need freetds, the problem is that the Haskell odbc
package doesn't declare its dependency on freetds.
2021-01-16 13:16:00 +13:00
toonn
07df700531
Spdx license expressions (#859)
* Add parser combinators to parse SPDX license expressions

The most important parser is `compoundExpression` it parses any SPDX
license expression into a list of SPDX simple-expressions.
The rationale is Nixpkgs' license metadata isn't capable of
distinguishing between the AND and OR relationships.
License exceptions aren't currently taken into account.

* Add tests for the SPDX parser combinators

I simply added a file with expressions that are expected to fail to
parse or parse successfully.

* Add the SPDX license list

The SPDX license list as attrsets following the nixpkgs lib.licenses
convention.

This uses fetchurl which is not ideal because it's not available during
pure evaluation.

It does not yet include the SPDX exceptions list.

* Refactor cabal-licenses.nix to use spdx/licenses.nix

The handling of the generic licenses is undecided still. Some have been
removed because they have better official identifiers.

* Refactor license mapping in builders

The common code in the comp- and setup-builders has been extracted and
refactored to use the SPDX expression parser.

* Use spdx-license-list-data from nixpkgs

This conveniently solves the impurity problem with using fetchurl : )
I'm not sure threading `pkgs` through everything to get access to the
spdx license list package is the right way to go about this.

* hscolour to "LGPL-2.1-only" and remove "LGPL"

* Use evalPackages for spdx and move shim to overlay

* Better fix for LGPL packages.

Co-authored-by: Hamish Mackenzie <Hamish.Mackenzie@iohk.io>
2021-01-14 14:33:40 +13:00
Hamish Mackenzie
64efc98852
Support githash package and cross package refs (#843)
* Adds support for cross package refs (with a project).  Relative
  directory references between packages within a project should now
  work.
* Adds `includeSiblings` to `cleanSourceWith`.  When `true` it
  prevents the `subDir` arg from causing filtering of other directories.
* Adds `keepGitDir` to `cleanGit` to allow `.git` directory to be kept
  (useful for components that use the `githash` package).
2021-01-14 12:34:06 +13:00
Hamish Mackenzie
0f7c5afc41
Add ghc 8.10.3 (#980) 2021-01-11 18:47:56 +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
paumr
a045d79264
Updated system-nixpkgs-map.nix and a default for X11 package (fixes #984) (#988)
After investigating adding a project argument to override the
mapping of libs to packages we realised we could fix the X11
package by updating `modules/configuration-nix.nix`.

We also updated `system-nixpkgs-map.nix` to allow multiple
packages to be mapped for a single library (turned out not
to be necessary for X11).

Co-authored-by: Rodney Lorrimar <rodney.lorrimar@iohk.io>
Co-authored-by: Hamish Mackenzie <Hamish.Mackenzie@iohk.io>
2021-01-08 13:10:00 +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
Samuel Evans-Powell
48b8674f5f
Add support for coverage (#762)
- Added the ability to generate coverage reports for packages and
  projects.
  - Outputs mix and tix information, as well as a HTML report.
- Added the "doCoverage" module option that allows users to choose
  packages to enable coverage for.
- Added a "doCoverage" flag to the component builder that outputs HPC
  information when coverage is enabled.
- Added the "overrideModules" library function to make it more
  ergonomic fo users to enable coverage on existing projects.
- Modified the "check" builder to also output ".tix" files (if they
  exist). This information is required to generate the coverage
  report.
- Added a test for coverage.
2020-09-29 11:56:24 +08:00
Ollie Charles
f655e66777
Changes to allow opencv to be built (#834)
* Changes to allow opencv to be built

The opencv library needs:

1. pkgconfig for opencv should return OpenCV 3, not OpenCV 2 (which is
   what pkgs.opencv is)

2. hardeningDisable = [ "bindnow" ] (as per
   5ea490af76#)

This commit fixes (1) by adding an entry to lib/pkgconf-nixpkgs-map.nix,
and partially fixes (2) by adding a new `hardeningDisable` option to the
set of package options. The user will still need to specify:

  packages.opencv.hardeningDisable = [ "bindnow" ];

I'm not sure if there's a place to specify this as default in haskell.nix.

* Update comp-builder.nix
2020-09-08 00:28:38 +12: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
b6de6ef3b8
Remove components.all (#776)
It causes a lot of issues. To make this work:

* `shellFor` is updated to use `getAllComponents` instead of `.all`.
* `getAllComponents` is updated to work on the package rather than
  the package config.
* Tests updated to not use `.library` or `.exes.X` where appropriate.
* Documentation updated.
* Out of date examples removed.

As a bonus `shellFor` now takes a `components` argument that might be
useful for limiting the dependencies of the shell to just the ones
needed for the components you intend to work on.
2020-07-21 16:06:54 +12:00