Commit Graph

185 Commits

Author SHA1 Message Date
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
Alexander Shestakov
17e2b7c69f
Allowing projects with odbc or hdbc-odbc to be built (#997)
* Adding odbc alias to the unixODBC package

* Adding odbc alias to the unixODBC package

* Adding odbc alias to the unixODBC package

* Adding comments about odbc package dependencies
2021-01-15 09:10:14 +00: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
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
paumr
91a7fa9407 moved xorg packages to correct attributeset
I'm wondering how/if this worked before, i couldn't find most xorg
packages on their previous path.
(Neither on the current version of nixpkgs nor on nixpkgs anno 2018)
2021-01-01 23:27:56 +01:00
Samuel Evans-Powell
4c42100df0
Coverage: allow projects with no libraries (#962)
* Coverage: allow projects with no libraries

- Prevent projects without a library from breaking the coverage report
  generators.
- Added a test to ensure projects without libraries can build coverage
  reports.

* Ensure the correct GHC version is used in project coverage reports

- Previously, when trying to determine the version of GHC to use for a
project coverage report, we would attempt to find the version of GHC
used in the constituent coverage reports, or default to the GHC that
is shipped with Nixpkgs. Using the GHC that ships with Nixpkgs is
problematic (specifically the coverage-no-libs tests fail to run on
Hydra), so we now ask the user to pass in the project to the
"projectCoverageReport" function so we can find the correct version of
GHC to use in a foolproof manner.
2020-12-10 20:47:57 +13:00
Zhenya Vinogradov
99fdad7640
Fix stack.yaml filtering when resolver file is in a subdirectory (#943)
* Fix stack.yaml filtering when resolver file is in a subdirectory

`maybeCleanedSource` tries to include the resolver file into the cleaned
source, if a resolver is specified, but it was only working when the
file was in the root of the project, because all directories would be
filtered out.

* fixup! Fix stack.yaml filtering when resolver file is in a subdirectory

Fix calculating relPath for paths using subDir

* Add test case for local stack snapshot located in a subdirectory
2020-12-09 17:43:36 +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
Michael Peyton Jones
20b6629205
Drop 19.09 support (#947)
* Drop 19.09 support

This is a year old. NixOS doesn't even support the last stable release,
let alone the one before that.

Also cuts our CI size by a third, which is always nice.

* Remove 19.09 compatibility pieces
2020-11-27 10:34:31 +13:00
Michael Peyton Jones
1dce3ffcb3
Don't reference scripts directly in materialization messages (#945)
Instead, give a hint as to how to get the appropriate scripts
as attributes.

Fixes #456, #877.
2020-11-27 00:33:51 +13:00
Hamish Mackenzie
e4be77ee93
Expose the plan.json file as plan-nix.json (#935)
Make the plan.json file available in case we need to debug plan-to-nix
2020-11-23 18:00:28 +13:00
Hamish Mackenzie
df98a8b0fd
Add an index-state to ghcjs-project (#928)
This should help guard against unwanted updates.
2020-11-18 21:15:21 +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
Thomas Tuegel
028eeb1a25
Recognize NCSA license from SPDX identifier (#926)
Cabal recognizes the NCSA license from its SPDX identifier ("NCSA") and no
longer reports "LicenseRef-NCSA".
2020-11-17 14:13:49 +13:00
Marc Fontaine
86f391a012
add a pkgconf alias for libusb1 (#924) 2020-11-13 15:56:46 +00:00
Joachim Breitner
bdd69693b9
Do not use evalPackages to create sourceRepo for builds (#918)
* Do not use evalPackages to create sourceRepo for builds

but still use it when creating source repo for plan calculation.

This might be a way to fix #917

* Update unit tests

* Refactor this patch, and add some comments

this is much less convoluted. I moved the fetchgit invocation from
`cabal-project-parser.nix` to `call-cabal-project-to-nix` (which makes
sense in a way, if a parser should return parsed data, and not do
stuff), and then some simplifications could happen.

Also added some comments.

* Update unit tests

* Dead code

* Less repetition in tests

* Comment tweaks

Co-authored-by: Hamish Mackenzie <Hamish.Mackenzie@iohk.io>
2020-11-11 11:49:27 +00:00
Hamish Mackenzie
654063dd6a
Fix #916 using -w instead of --with-compiler (#922) 2020-11-11 15:01:59 +13:00
Hamish Mackenzie
24fadac889
Add comment (#921) 2020-11-10 21:13:12 +13:00
Hamish Mackenzie
53bc8e033c
Fix for #920 2020-11-10 17:41:57 +13:00
Hamish Mackenzie
3991463043
Revert "cleanGit: Detect when called inside a submodule (#847)" (#890)
This reverts commit 3798469c3f.
2020-10-20 22:25:34 +13:00
Michael Peyton Jones
0e12a743d6
Be more liberal about where the index-state comes from (#872)
Fixes #844.
2020-10-13 15:41:04 +13:00
Rodney Lorrimar
b12905981d
Fix hpc for cross-compiled builds (#862)
* Add Hydra build products for test coverage reports (HTML links and zip files)

* Fix hpc on cross builds
2020-10-06 13:29:57 +10: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
John Ky
2a15520113
Add mswsock system package mapping (#853) 2020-09-21 11:36:48 +08:00
Thomas Tuegel
3798469c3f
cleanGit: Detect when called inside a submodule (#847)
If cleanGit is called inside a submodule, the true gitdir is not available, so
fall back to cleanSourceWith as if called outside the repository.
2020-09-16 22:25:40 +12: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
fa25a679bc
Allow older ghc versions in cabalProject (#817)
Currently the `dummy-ghc-data`, `nix-tools` plan and `cabal-install`
plan must be materialized for the selected `ghc`.  This change
relaxes that restriction and will instead use `nix-tools` and
`cabal-install` built with a fixed `ghc` version (currently `ghc865`)
and will calculate the `dummy-ghc-data` as an IFD.

It will `__trace` a warning of the form:

```
WARNING: No materialized dummy-ghc-data for ghc-8.6.4-x86_64-darwin.
```
2020-08-14 19:22:30 +12:00
Michael Peyton Jones
5bdfe10f69
Check the right platform when setting LOCALE_ARCHIVE (#810)
This runs on during evaluation, so needs the evaluation platform's libc.
2020-08-12 13:22:56 +12:00
Toon Nolten
1941894b86
Fix wording of ghc argument deprecation warning (#803) 2020-08-06 21:33:17 +08:00
Hamish Mackenzie
85609feac4
Improve cabal.project parsing (#802)
Currently adding comments to a `source-repository-package` breaks the
parser.
2020-08-06 14:59:26 +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
2162bea885
Fix subdir: . in source-repository-package (#799) 2020-08-04 15:09:13 +12:00
Hamish Mackenzie
6b37cca8bd
Fix for gi-harfbuzz 0.0.3 (#796)
It adds `pkgconfig-depends: harfbuzz-gobject >= 1`.  In nixpkgs
this is in the `harfbuzz` derivation so we need a mapping.
2020-08-01 15:29:32 +12:00
Hamish Mackenzie
251c899804
Fix use of multiple subdirs in cabal.project (#790)
It is now possible to specify multiple subdirs in a
`source-repository-package` block.  This change fixes the parser
code in haskell.nix so that it understands.
2020-07-28 14:19:58 +12:00
Hamish Mackenzie
6935e7d044
cleanGit on an already cleaned copies to store (#788)
```
cleanGit {
  src = cleanSrcWith { ... }
}
```

Results in the full `src` being copied to the store before filtering
the files not in the git index.

This change uses `src.origSrcSubDir` if it exists to avoid this.
2020-07-27 10:22:19 +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
cacfba0b45
Replace ghc 8.8.3 with 8.8.4 (#766)
Also adds some tooling/docs for adding new ghc versions (see `docs/adding-new-ghc.md`)
2020-07-21 14:10:23 +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
Moritz Angermann
a2bc3db0f1
Fix cabalProject { src = ./.; } (#751) 2020-07-07 14:22:56 +08:00
Hamish Mackenzie
c7736060cc
download stack resolver if a sha256 is provided (#748)
This change allows a resolverSha256 to be passed to stackProject.
When provided the resolver found in the stack.yaml is fetched
using this sha256 and the uri string is replaced with the
path to the fetched version.
2020-07-04 14:35:52 +12:00
Hamish Mackenzie
5291959d28
Add propagatedBuildInputs to shell (#717)
Now that the pkgconfig inputs are here we need this to make them
show up in the shell.  Also adds gtkglext pkgconfig mapping.
2020-06-21 19:40:14 +12:00
Hamish Mackenzie
d98b1e3b6e
Add sha256map to cabalProject & stackProject (#697)
This is a simple way to specify the sha256 values for references
to git repositories that do not have a `--sha256:` comment in the
`cabal.project` file or a `# nix-sha256:` comment in the `stack.yaml`
file.

The tests demonstrate how to use `sha256map` with both
`cabalProject` and `stackProject` to build the
haskell-language-server from github with the sha256 hashes
needed to work with `--option restrict-eval true`.
2020-06-16 13:40:19 +12:00
Hamish Mackenzie
36836c1f58
Revert "Fixes #680 (#682)" (#690)
This reverts commit 53af0dec9b.
2020-06-15 15:08:35 +12:00
Poscat
53af0dec9b
Fixes #680 (#682) 2020-06-15 13:32:20 +12:00
Hamish Mackenzie
dcadfa8ab4
Use suitable hackage state for index-state (#673)
Fixes #672 by using the first index-state that is > than desired
index state.  It also passes `--index-state` to `cabal v2-cconfigre`
to make sure it cabal uses only the packages in the hackage
file that are before the specified date.

Fixes #540 by returning the `index-state` used back out of
`cabalProject` in the same way `plan-nix` is returned.
2020-06-13 01:03:17 +12:00
Moritz Angermann
794acb7b01
Update system-nixpkgs-map.nix (#670) 2020-06-11 10:10:55 +08:00
Owen Shepherd
0b364fd718
added gfortran -> gfortran.cc.lib mapping (#669) 2020-06-11 09:44:53 +08:00