303 Commits

Author SHA1 Message Date
Moritz Angermann cff33ed43c Support for armv7a-bionic (android)
This adds support to haskell.nix for building for armv7a-android.
It includes
- various minor fixes
- a lot of bionic (libc) patches for ghc
- no gold on 32bit android
- android overlay: mostly static
- disable KTLS on openssl for android
2023-03-15 10:54:45 +03:00
Peter Becich c0e61ad3f4 remove references to pmdk (#1867)
In `nixpkgs`:
```
pmdk = throw "'pmdk' is discontinued, no further support or maintenance is planned by upstream"; # Added 2023-02-06
```
https://github.com/NixOS/nixpkgs/blob/9e56d6ec92c8fb4192f1392aa5c4101ad77f2070/pkgs/top-level/aliases.nix#L1230
2023-02-28 23:31:53 +13:00
Hamish Mackenzie 048316b2b3 Add support to define materialized directory for compiler materialization (#1851)
* Add support to define materialization directory

* Fix ghcjsProject

---------

Co-authored-by: Dylan Green <dylan.green@obsidian.systems>
2023-02-20 21:02:39 +13:00
Hamish Mackenzie 4413b6a9b9 Bump nixpkgs pins, add 22.11 to CI (#1815)
* Bump nixpkgs pins, add 22.11 to CI

* Bump nixpkgs pins, add 22.11 to CI

* Bump nixpkgs pins

* Bump nixpkgs pins

* Remove references to old pkgconfig packages

* Bump nixpkgs

* Fixes for latest nixpkgs

* ifdLevel 1

* Bump nixpkgs pins

* Remove top level required jobs

* ifdLevel 2

* ifdLevel 3

* ifdLevel 1

* ifdLevel 0

* Bump nixpkgs used in default.nix

* Build ghc 9.4.4 not 9.4.3 in ci for R2211

* Just build ghc 8.10.7

* Just build ghc 8.10.7

* Recreate flake.lock

* Include newer ghc versions

* Skip ghc 9.4 until 9.0 is built

* ifdLevel 1

* ifdLevel 2

* Add ghc 9.4

* ifdLevel 1

* ifdLevel 2

* ifdLevel 3
2023-02-13 12:07:09 +13:00
Andrea Bedini 7075077d46 Support revisions and more (#1775)
* Support revisions

Cabal files are now obtained from the index tarball (as cabal does)
directly. This allows us to always pick the cabal file revision that
cabal would pick, without having to understand or reference hackage.

* Update nix-tools materialised plan for new tooling

* Update materialized files

* Eval on x86_64-linux

* Turn off full materialization check

* Replace pkgs.writeText with passAsFile

Nix derivations are already able to pass a attribute to the builder as a
file. This means we don't need to use pkgs.writeText to turn the
cabalFile attribute into a file, saving one derivation.

* Bump closure size limit to 540

---------

Co-authored-by: Hamish Mackenzie <Hamish.K.Mackenzie@gmail.com>
2023-02-09 12:55:40 +13:00
Hamish Mackenzie 7573eb34f6 Fix ghc 9.4.3 TH support (#1814) 2023-01-24 11:12:44 +13:00
Jean-Baptiste G c22fb2e435 inputMap: add missing fallback to repoData.rev (#1818)
to properly support inputMap keys without rev.
2023-01-07 19:24:39 +13:00
Hamish Mackenzie 6c992eacf6 Use hadrian to build ghc 9.4 (#1475)
Adds GHC 9.4 and uses hadrian to build it.

This also updates the way iserv-proxy and remote-iserv are built as they now have their own package and gitlab repo.

Co-authored-by: Moritz Angermann <moritz.angermann@gmail.com>
2022-12-08 15:01:05 +13:00
Peter Becich 375c499d73 remove digibyte and digibyted (#1800) 2022-12-05 17:21:40 +13:00
Hamish Mackenzie 9c3ceab124 Fix issue with nixpkgs 21.05 (#1792)
This version of nixpkgs is still needed for old ghc cross compilation to windows.
2022-11-28 22:25:20 +13:00
Hamish Mackenzie cbf1e918b6 Add ghc 9.2.5 (#1779)
* Add ghc 9.2.5

* More materialization updates

* More materialization updates

* More materialization updates

* Remaining materialization changes

* Fix ghcjs cabal materialization issue
2022-11-15 17:12:14 +13:00
Hamish Mackenzie e601c9ce60 Add ciJobs and hydraJobs to the flake output (#1761)
* Add ciJobs and hydraJobs to the flake output

* Adds Cicero support.

* Includes only some darwin native builds in hydra release.nix required (to avoid OOM issues when everything is in there).
2022-11-04 16:37:43 +13:00
Jean-Baptiste G fe0ca508e2 better pkg config path for devshell + access to variants from project (#1760)
* devshell: better definition of PKG_CONFIG_PATH

 that manually going through pkg-config of all packages.
 Also filter out non-derivation from nativeBuildInputs.

* Add project.projectVariants that apply flake.variants modules

* Move projectOverlays.devhshell to haskellLib.devshellFor
2022-10-21 17:30:31 +01:00
Hamish Mackenzie a070082964 Improve flake code (#1743)
* Add hydraJobs.devShell and flatten hydraJobs

Also moves the `rawFlake` code into a `haskellLib.mkFlake` function

* Unflatten hydraJobs and add ciJobs

It turns out it is nice to use system first in the hierarchy for cicero.  Also both hydra and cicero are ok with a deep hierarchy of attributes.

* Refactoring

* Add mkFlakeCiJobs

* Avoid `:` in ciJobs and hydraJobs

* Use cabal names again in ciJobs

* More updates

Turns off code coverage by default.
Rename flattenChecks to mkFlakeChecks.
Adds flake packages to ciJobs and hydraJobs.

* Expand comment
2022-10-11 23:52:50 +13:00
Hamish Mackenzie f80e2d6370 Let cabal configure errors break IFD (#1744)
In the past hydra didn't give good feedback on eval time errors.  Deferring the errors was a way to get them into a build log (instead of the eval log that would get overwritten with the next eval).

I'm not sure how well this actually worked since it is super easy to introduce an eval time dependency on a broken project.  For instance if you try to enumerate the components in a project haskell that failed to configure the error would be forced (in some cases a more cryptic one).

Now that hydra is better at reporting eval errors I think we should try to fail fast again.
2022-10-10 13:21:16 +13:00
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
Jean-Baptiste G 4852bdb60c devshell: add pkg-config dependencies and set PKG_CONFIG_PATH. (#1725) 2022-10-03 18:01:13 +13:00
Maxim Koltsov a30665693a Fixes re source-repository-package (#1715)
* Fix regex to match source-repository-package tag

Regex to tell ref from rev was wrong

* Fix fetchGit call when rev and sha256 unspecified

* Update expected output for unit test

* Auto retry concurrency check that keeps failing

Co-authored-by: Hamish Mackenzie <Hamish.K.Mackenzie@gmail.com>
2022-09-30 13:33:56 +13:00
Mango The Fourth 57d10b2791 fix stack-cache-mismatch by enabling submodules (#1722) 2022-09-30 12:43:59 +13:00
Jean-Baptiste G d6ce79f4b5 fix devshell support for exactDeps = false. (#1721) 2022-09-29 15:25:13 +01:00
Hamish Mackenzie 64e8460c35 Bump nixpkgs pins (#1710)
* Fix ghcjs for time_t is 64bit in emscripten now.
* Fix error: qca2 has been removed, because it depended on qt4.
* Add spdx 3.18 materialization.
* Turn off building tests for wine-5.4 (due to IDL issue).
* Fix options-doc.nix.
* Comment added to force rebuild on hydra
2022-09-27 13:00:15 +13:00
Hamish Mackenzie 95b9f13d13 Remove webkitgtk24x-gtk3 mapping (#1706)
* Remove webkitgtk24x-gtk3 mapping

Even just looking for `pkgs.webkitgtk24x-gtk3.version` crashes nix eval with:

```
error: webkitgtk24x-gtk3 has been removed because it's insecure. Please use webkitgtk.
```

* Pin hlint for tests

* Pin hlint for tests
2022-09-21 20:48:01 +12:00
Hamish Mackenzie 4c8bbbd3ed Add flake.variants (#1661)
* Add flake.variants

This allows flakes to easily include variations of the
project by with different project arguments.
Anything you can pass to `project.addModule` can be used.
For instance to include variants using ghc 9.2.4:

```
flake.variants.ghc924.compiler-nix-name = pkgs.lib.mkForce "ghc924";
```
Then use it with:

```
nix build .#ghc924:hello:exe:hello
```

This change also:

* Exposes add `combineFlakes` and `rawFlake` for more control over how flakes are combined.

* Includes package coverageReports to the `hydraJobs` of the flakes.

* Tries to make the materialisation concurrency test more reliable
2022-09-16 22:21:54 +12:00
Hamish Mackenzie a197fd0afb Add cabal-issue-8352-workaround (#1671)
* Add cabal-issue-8352-workaround

See https://github.com/haskell/cabal/issues/8352

* More script fixes

* More script fixes
2022-09-15 17:13:05 +12:00
Matt Parsons 25b47bf1d0 Determine if the tag is a ref or a rev (#1665)
* Determine if the tag is a ref or a rev

Test the `tag` attribute in the `cabal.project` file. If it looks like a
git hash, then assign it to `rev`. Otherwise, assign it to `ref`.

* ok

* ok

* lmao

* Address comments

* better if not present
2022-09-15 15:22:01 +12:00
Peter Becich 965c7acf2c Update HPC for better compatibility with large projects (#1484)
* patch hpc to allow files to be used for the list of src dirs, hpc dirs, and includes

* delete trailing whitespace

* use Response Files for HPC arguments; delete unnecessary patch

* Add ghc patch based on what was merged upstream

* Fix coverage tests

* Update responseFile usage

* Enable coverage-no-libs test

Co-authored-by: Richard Wallace <rwallace@thewallacepack.net>
Co-authored-by: Hamish Mackenzie <Hamish.K.Mackenzie@gmail.com>
2022-09-14 21:24:21 +12:00
Armando Ramirez 49c4aa4a15 haskell-nix.extraPkgconfigMappings (#1667) 2022-09-14 17:58:27 +12: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
Hamish Mackenzie 2b9b99a537 Fix implicit cabal project (#1639)
#1588 does not provide an implicit project the way cabal does.  So for instance:

```
$ cabal unpack hello
$ cd hello-1.0.0.2
$ echo 'constraints: hello<0' >cabal.project.local
$ cabal build all
Resolving dependencies...
Error: cabal: Could not resolve dependencies:
[__0] next goal: hello (user goal)
[__0] rejecting: hello-1.0.0.2 (constraint from project config
/Users/hamish/iohk/hello-1.0.0.2/cabal.project.local requires <0)
[__0] rejecting: hello-1.0.0.1, hello-1.0 (constraint from user target
requires ==1.0.0.2)
[__0] fail (backjumping, conflict set: hello)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: hello
```

So even though there was no `packages:` it is looking for the package in the default location (the default is `packages: ./*.cabal` according to the cabal docs).

I also checked that including `packages:` in `.local` does not change the implicit `packages: ./*.cabal` with:
```
$ cabal unpack split
$ echo 'packages: ./split-0.2.3.5' > cabal.project.local
$ cabal build hello:exe:hello split:lib:split
```
2022-09-02 19:58:50 +12:00
Las Safin fc5a5b4888 cabalProject': Consider cabalProjectLocal even if cabalProject argument is null (#1588)
* `cabalProject'`: Consider `cabalProjectLocal` even if `cabalProject` argument is null

* Respond to review
2022-09-02 13:22:07 +12:00
Hamish Mackenzie de81c31829 Fix materialization message (#1635)
Strings with context are the ones in the store that cannot be updated with the script (not the other way around).
2022-08-31 23:50:28 +12:00
Armando Ramirez 236ad8debe Map opengl32 and glu32 to null on Windows (#1615) 2022-08-25 17:04:56 +12:00
Hamish Mackenzie 05c0555400 Add flake support to hix (#1572)
This adds support for using nix flakes commands with hix.  This is done by creating a hidden `.hix-flake` directory and passing the source in using `--override-input`.

It also includes a `hix init` command to add a `flake.nix` and `nix/hix.nix` configuration file.
2022-08-05 10:17:16 +12:00
Jean-Baptiste G ee6a6559e1 devshell: only provide binutils on gnu plateform (#1573) 2022-08-02 23:24:04 +12:00
Jean-Baptiste G df62d93a7b devshell: remove non-derivation from packages list add missing binutils. (#1571) 2022-08-01 23:59:11 +12:00
Hamish Mackenzie 5341ac4a65 Avoid using srcOnly (#1563)
New versions of `srcOnly` pass the `prePatch` hook in and we `cd` into the sub directory for the package in that hook.  This means that the output includes only the package subdirectory.

We worked around this, but the work around breaks for older nixpkgs where `prePatch` is not passed.

This change replaces the use of `srcOnly` and instead uses the same trick as source so that the `buildPhase` is replaced and runs in the expected source directory (including and it should still include any sibling directories that have not been filtered).
2022-07-29 19:23:39 +12:00
Jean-Baptiste G 7c0a91eab2 devshell: provide stdenv native deps (#1560)
should fix devshell for darwin, which should depends on
 clang and not gcc.
2022-07-29 11:26:25 +12:00
Yvan Sraka 98b1edc73b Add mapping to Cabal extra-libraries: bcrypt (#1561)
https://docs.microsoft.com/en-us/windows/win32/api/bcrypt/

N.B. The `BCryptGenRandom` symbol is provided by MinGW `bcrypt.h` and needed by
https://github.com/yvan-sraka/greetings (and I guess any project relying on
Rust `std`) when cross-compiling to `x86_64-w64-mingw32`
2022-07-29 09:33:37 +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
Yvan Sraka e3397e0ace Turn off trace messages (when checkMaterialization is disabled) to not bother user (#1555) 2022-07-27 09:10:13 +12:00
Samuel Evans-Powell 0dca71e2f3 Improve coverage reports (#1548)
* Provide an empty coverage report when package has no coverage

- When covering a project with multiple packages, the project coverage report
  will produce a table of individual coverage reports for each package. The
  links in this table don't go anywhere when a package is uncovered (they are
  broken links).
  - By producing an empty coverage report when a package has no coverage, we fix
    the broken links, and provide a tad more information about the coverage
    state of that package.

* Improve project coverage report index page

- Provide a link to the union/all coverage report.
- Format the reports as a list instead of a table of one column.
- Provide better explanation of what each report means.

* Add warning explaining modules with no coverage

- Modules that have no coverage at all are simply not included in the HTML
  reports generated by HPC.
- Add a warning to the project coverage report index page so users are aware of
  this limitation of HPC.

* Simplify interface of coverageReport

- Remove the concept of "package boundaries" from the "coverageReport" function.
- The "coverageReport" is now a function of:
  - arbitrary checks generating tix files
  - arbitrary mix modules
- This more closely reflects the usage of hpc, which doesn't care about package
  boundaries.
- Use this new "coverageReport" function to simplify the "projectCoverageReport"
  implementation. A project coverage report now simply:
  - copies out constituent coverage reports.
  - writes out an "all coverage report" using all checks in the project and all
    mix modules..
  - writes out a summary index page.
2022-07-19 19:40:41 +12:00
Jean-Baptiste G 80082aebba Add missing deps to devshell overlay, remove cabalWrapper (#1549)
since it needs custom shell setup and knowledge not wanted/necessary for
 many project. cabalWrapper can still be used from iohk-nix, until
 underlying issue is handled natively by cabal.

 Also remove packagesExes materialization attributes,
 not really useful anymore, given faster evaluation of recent haskell.nix
2022-07-19 19:16:35 +12:00
Hamish Mackenzie 4e01f34543 Add nixpkgs-2205 and update other nixpkgs pins (#1506) 2022-07-17 18:18:19 +12:00
Robert Hensing f9090d21d7 check.nix: Don't cd when src is from srcOnly (#1542) 2022-07-13 12:25:27 +12:00
Sascha-Oliver Prolic 00fc9204fa add glew (#1534)
* add glew

* move glew

* move glew to GL and GLU
2022-07-04 09:59:57 +01:00
Hamish Mackenzie 7c26ef068a Don't require materialized spdx fixes #1515 (#1516) 2022-06-16 00:21:52 +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 91036142ef Better support for allow-import-from-derivation=false (#1474)
Currently haskell.nix uses IFDs internally in a number of places.  This prevents the use of `--option allow-import-from-derivation false` even when `materialized` nix is provided.

* Changes `materialize` function so that it returns the `materialized` path when possible instead of a derivation (updates import-and-filter-project.nix to cope with that).
* Materializes the spdx json file.
* Prevents haskell.nix looking for `cabal.project`, `cabal.project.local` and `cabal.project.freeze` files in hackage packages and the ghc-extra-projects.
2022-06-02 20:11:27 +12:00
Armando Ramirez 1b0eac78c6 Support 'extra-libraries: m' (#1453) 2022-05-26 19:52:15 +12:00
Daniel Firth 417a923a3e Add freetype2 to pkgconf-nixpkgs-map (#1478) 2022-05-23 10:05:51 +01:00