Commit Graph

139 Commits

Author SHA1 Message Date
Mango The Fourth e49b15fefc Choose proper llvm version for llvm-hs and make stack infra work like stack does (#1724)
* update llvm-hs llvm from 11 to 12

* allow passing version args to build-tools; fix llvm-hs build-tools, pass allRefs to builtins.fetchGit to allow fetching non-standard-refs (to mirror stack behaviour)
2022-10-04 23:20:50 +13:00
Hamish Mackenzie ec0c59e2de Support for packages with only tests (#1732)
* Support for packages with only tests

Fixes #362

* Fix for ghcjs
2022-10-03 15:39:47 +13:00
Hamish Mackenzie 7462e537ef Fix building the stack tool (#1723)
Fixes #218

Tested with:

```
nix-build -E '((import ./. {}).pkgs-unstable.haskell-nix.tool "ghc924" "stack" "2.9.1")'
```
2022-09-30 21:54:38 +13:00
Hamish Mackenzie 6c7f9d0042 Use cabal 3.8 (#1641)
A bug was fixed in cabal 3.8 (https://github.com/haskell/cabal/issues/6771) that haskell.nix relied on for `pkg-config` in support.  To work around this we added a dummy `pkg-config` that `cabal configure` now uses when haskell.nix runs it `cabal configure` internally.  That returns version information for all the `pkg-config` packages in `lib/pkgconfig-nixpkgs-map.nix`.  This mapping has also been expanded based on the results of searching nixpkgs for `*.pc` files.

This update also includes workarounds for:

https://github.com/haskell/cabal/issues/8352
https://github.com/haskell/cabal/issues/8370
https://github.com/haskell/cabal/issues/8455
2022-09-13 12:00:04 +12:00
Chua Hou 5d5d471409 Set meta.mainProgram for executable components (#1539)
- This allows nix run to work correctly, so that it knows the correct
  name of the executable, as it would otherwise attempt to execute an
  executable named "project-name-exe-exeName", for example.
- See #1231.
2022-07-06 23:25:58 +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 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 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 bfeea3e894 Allow packages to specify external static plugins 2022-05-02 11:08:42 -04: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
Cheng Shao 18ebf60137 Fix libnuma dependency in rts.conf (#1342) 2022-02-15 23:49:45 +13:00
Teo Camarasu 02f34c6f36 fix typo (#1362) 2022-02-04 14:52:37 +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
Javier Sagredo 0e2ae928e2 Rename executable-profiling flag as suggested by Cabal (#1136) 2021-12-27 15:28:59 +08: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
Hamish Mackenzie 062a0317b6 Check that the library component package.conf.d/*.conf file is created (#956)
Had a strange issue where eval of #955 and it might have been caused
by a the nix-tools library seeming to have no `.conf` files.

Since it seemed to go away by itself I think this was a nix GC issue
or something.  Here is some code we could add to the builders to
double check the files are created if it turns out that is not the
case.

Co-authored-by: Rodney Lorrimar <rodney.lorrimar@iohk.io>
2021-07-06 13:24:17 +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
Richard Wallace f9e3eafbe0 there isn't always an autogen directory on macOS, which can cause the builds to fail (#1117) 2021-05-20 14:26:41 +12:00
Hamish Mackenzie ae7be4559f Fixes for windows cross compilation (#1103) 2021-05-03 19:14:19 +12:00
Hamish Mackenzie 618ff607d3 Fix shellFor components argument (#1079) 2021-04-08 15:33:09 +12:00
Richard Wallace 93ab4310e9 improve keepSource cleanup (#1080) 2021-03-25 14:07:04 +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 4d700cf155 Fixing emcc usage in haskell.nix ghcjs (#1064)
* Use emscripten branch of GHCJS for 8.6

* Adds release-linux-only.nix (for hydra with no mac builders)

* Sets HOME to a temp dir once per derivation to help performance of emcc

* Updates materialization

* Uses symlinks to reduce ghc derivation size for wrapped ghcjs

* Removes compiler-nix-name test
    This test checked that the default compiler was overridden by the
    compiler-nix-name arg.  There is no default any more.

The GHCJS branches used include fixes for:

* hs$ret_1 typo (should be hs$ret1)

* A bignum issue
2021-03-12 12:21:07 +13:00
Hamish Mackenzie bab2eaea62 Enable debug info on linux targets (#1050)
* Add `.debug` to build any component with DWARF dugug info on linux
  (ghc >=8.10.2).
* Pass `enableDWARF` to `shellFor` for to get a shell where all the
  components are the `.debug` ones.
2021-02-22 18:27:36 +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 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 250509f23f Add nixpkgs-unstable (#1025) 2021-02-03 22:38:33 +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 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 dbff20d0c8 Make haskell.nix quieter (#944)
* Remove unconditional trace for index-state

We already have messages for unusual cases (like using the latest
index-state). This message is unconditional, so quite noisy.
We include the actual index-state in the builer log so it's available if you
want to check it.

* Move source-cleaning warning to builder log

It's not *that* interesting, and someone who cares will likely check the
log.

* Move shellFor trace message to builder log

Not that interesting, really.

Co-authored-by: Hamish Mackenzie <Hamish.Mackenzie@iohk.io>
2020-11-27 14:18:15 +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
Moritz Angermann b06fdfa065 Adds experimental TSan logic. This will require a custom compiler (#910)
(cherry picked from commit 0f640b4285)

Co-authored-by: Hamish Mackenzie <Hamish.Mackenzie@iohk.io>
2020-11-06 18:23:12 +13:00
Moritz Angermann 23539aef9e Add enableDWARF and useLLVM (#909)
(cherry picked from commit dc44dbcfe5)
2020-11-05 18:43:38 +13:00
Moritz Angermann 778f1ab81e Enable ghci libraries (#908)
(cherry picked from commit 3e7fde0a2c)
2020-11-05 18:43:25 +13:00
andremarianiello ddbb4a50b9 Stop using deprecated lib.nixpkgsVersion (#876) 2020-10-13 15:38:12 +13:00
Hamish Mackenzie ab2f5a9b6d nixpkgs 20.09 pkg-config has a prefix (#874)
From nixpkgs 20.09, the pkg-config exe has a prefix matching the ghc one
2020-10-12 23:41:29 +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
   https://github.com/LumiGuide/haskell-opencv/commit/5ea490af7662fe74b3740619963d37f1fd91e3d4#)

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
Hamish Mackenzie 41d731603f Fix warning message for checkPhase (#835) 2020-09-05 13:57:54 +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 e340658306 Use internal-nix-tools for hpack (#816) 2020-08-12 21:40:18 +12:00
Hamish Mackenzie 3c458f5c45 Add another check for #660 issues (#805)
Currently if the `ghc-pkg` fails during the last stage of building a library component
(perhaps because of https://github.com/NixOS/nix/issues/719) the failure is ignored.
This seems to be the most likely cause of the bad `config` derivation.

This change should cause the derivation build to fail instead of making invalid
files when this happens.
2020-08-09 11:57:30 +12:00
Michael Peyton Jones 1687b5d2a1 Fix types of some meta attributes (#806)
These can't be null. They could perhaps be absent, but I can't figure
out how to set an attribute only if something else isn't null in a nice
way, and having it be the empty string seems fine.

Fixes #804.
2020-08-08 13:20:16 +12:00
Hamish Mackenzie a904d403d8 Improve hpack support (#800)
Use up to date hpack in comp-builder.nix

Avoid running hpack when we have a .cabal file already
2020-08-05 01:02:47 +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
Hamish Mackenzie 47f0cded18 Fix haddock when pkgconfig is needed to configure (#732)
Packages like haskell-gi need pkgconfig at configue time to generate
source files we want to run haddock on.

This change also brings back a `mkdir` for the $docs that is needed
for haddock of bytesting-builder (it was removed when haddock the
haddock derivation was split out).
2020-06-29 14:46:19 +12:00
Hamish Mackenzie 128dbef133 Replace lib.fix with recursive let in builders (#730) 2020-06-27 22:31:52 +12:00