Commit Graph

288 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
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
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
Jean-Baptiste Giraudeau b66b0445eb Allows project to be easily extended. (#1467)
* Allows project to be easily extended.

* Add common project overlays
2022-05-13 21:21:19 +12:00
Ewout f1bb3aa2f2 Fix cleanGit when src is a git submodule. (#1469)
Suppose you have a repository with a submodule checked out in the
subdirectory `smod`.

`cleanGit { src = ./smod; }` would return the following error:

    error: getting status of '/.git/modules/smod': No such file or directory

`smod/.git` is a file that contains a reference to the git module repo.

    gitdir: ../.git/modules/smod

This is the same as a worktree (in fact, isWorktree = true here),
but it's a relative path instead of an absolute path.

Co-authored-by: Ewout Van Troostenberghe <evantroostenberghe@hubspot.com>
2022-05-13 20:00:41 +12:00
paumr df89dc99f3 added icu-i18n mapping (#1451) 2022-04-22 16:03:58 +01:00
Hamish Mackenzie 1f5c9b28bf Fix ghcjs 8.6.5 and 8.8.4 (#1447)
Also hydra now builds ghcjs 8.8.4, 8.6.5 and 8.10.7 on x86_64-linux build ghcjs 8.10.7 on x86_64-darwin
2022-04-21 12:46:49 +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 8eb5d29d37 Support Nix <2.4 (#1418)
* Downgrades the error to a warning.
* Adds `filterPath` as a way to disable filtering to have caching work between Nix <2.4 and >=2.4.
* Disables filtering on `haskell-nix.hackage-project` based functions (should make all the GHC derivations the same).

I think it would also be possible to make a `filterPath` implementation that recursively used `builtins.readDir` and called the `filter` function to implement filtering on Nix <2.4, but I am not sure if it is worth it.

Anyone that needs the old behaviour for project packages (consistent filtering between <2.4 and >=2.4, but not between store and local) replace:

```
project = pkgs.haskell-nix.cabalProject {
  src = pkgs.haskell-nix.haskellLib.cleanGit {
    src = ./.;
  };
};
```

```
project = pkgs.haskell-nix.cabalProject {
  src = pkgs.haskell-nix.haskellLib.cleanGit {
     src = {
       outPath = ./.;
       filterPath = { path, ... }@args:
         if builtins.hasContext (toString path) then path else builtins.path args;
     };
  };
};
```
2022-03-29 01:24:01 +13:00
DavHau a385241331 Remove canCleanSource (#1409)
In recent nix, builtins.path works in restricted eval mode.
Therefore canCleanSource is not required anymore.

follow up on #1403

* add comment on hydra overlay

* throw error on outdated nix version
2022-03-25 12:57:36 +13:00
DavHau 1ca99326b2 always clean the source, no matter what (#1403)
* always clean the source, no matter what

* update hydra
2022-03-19 02:08:11 +13:00
Hamish Mackenzie c5fa3f4a4b nixpkgs gdk_pixbuf is now gdk-pixbuf (#1398) 2022-03-12 21:25:18 +13:00
Hamish Mackenzie 6fce9ef514 spdx json file is in a .json output for latest nixpkgs (#1397)
See https://github.com/NixOS/nixpkgs/pull/161958
2022-03-12 20:03:27 +13:00
Carsten Csiky 95b3617b2a Add icu-i18n as alias to nixpks-map (#1395)
This is necessary because this alias is used by `text-icu` https://github.com/haskell/text-icu/blob/master/text-icu.cabal#L72
2022-03-08 11:32:10 +00:00
Michael Peyton Jones 315b6d353d Don't use allowSubstitutes=false (#1389)
`runCommandLocal` sets both `preferLocalBuild=true` and
`allowSubstitutes=false`. There's an
[argument](https://github.com/NixOS/nix/issues/4442) that the latter is a
misfeature. There's really no reason not to download something from a
substitutor if it's actually been built already.

We can get the effect that we want easily enough by just setting
`preferLocalBuild=true` alone.
2022-03-03 15:17:42 +13:00
Michael Peyton Jones 4751dc70a6 Use gitMinimal in call-cabal-project-to-nix (#1387)
This was using full `git`, which isn't part of the project `roots`, and so
would often not be cached.

I don't know how this ended up not being problematic before, since this
has been here for a while...
2022-03-03 12:44:58 +13:00
Hamish Mackenzie e2b12dbff7 Only pass --index-state to cabal when asked (#1384)
Currently we pass the `--index-state` argument to `cabal` for configuration of a project even if it was found in the `cabal.project` file.  This must have seemed harmless enough when we set it up that way, but it causes problems if there are `repository` blocks in the `cabal.project` file.

So for instance if we have a `cabal.project` with:

```
index-state: 2022-01-22T00:00:00Z
index-state: ghcjs-overlay HEAD

repository ghcjs-overlay
  url: https://raw.githubusercontent.com/input-output-hk/hackage-overlay-ghcjs/8756b0891a0a550cc8b00dacd24227aee483c0ca
  secure: True
  root-keys:
  key-threshold: 0
```

With the intention of using the `HEAD` version of the `ghcjs-overlay` and letting the commit hash in the `url` ensure it is stable.  The first `index-state` is found and `--index-state 2022-01-22T00:00:00Z` is passed on the command line to `cabal`.  This overrides the `HEAD` setting for `ghcjs-overlay` and because the timestamps in the `ghcjs-overlay` depend solely on when the `hackage-overlay-repo-tool` ran none of them are included.

The solution is to pass `--index-state` to `cabal` only when it was passed into the project function.  When it is not provided `cabal` should still respect the setting in the `cabal.project` file, but it will not elevate it to replace other settings as it does now.
2022-02-24 23:55:06 +13:00