Commit Graph

44 Commits

Author SHA1 Message Date
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 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 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
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 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
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
Hamish Mackenzie 41b72e182a Keep source for component builds (#345)
This fixes and issue with TH functions like `makeRelativeToProject`
that can be used to keep a reference to source files.  If they are in
a temporary location that can result in surprising `file not found`
errors at run time.

It may also be useful for making debug symbols and the like refer to
real files.

There is a risk that keeping the source for all packages could expand
closure sizes (if for instance debug info is wanted, but you do not
want to keep the source in the store).  For that reason we have
made this an option that must be enabled.
2019-12-13 16:43:27 +13:00
Hamish Mackenzie 79c2c631c3 Run the cross compiled tests on wine (#317)
Changes to the haskell.nix code to fix broken tests:

* Add missing `then` to `call-cabal-project-to-nix.nix`.

* Fix default `hsSourceDirs` so that `.` gets included for `.all` component if one of the components does not have a `hsSourceDir` set.

* Fix `haskellNixRoots` so it works when cross compiling to windows.

Improvements to the haskell.nix tests:

* Run haskell.nix tests of nixpkgs 19.03 and 19.09.

* Run haskell.nix tests cross compiled to Windows under Wine (when possible).

* Add nix used as IFD inputs as tests to ensure they are cached.

* Use `haskell-nix.cabal-install` instead of `nixpkgs.cabal-install` in tests.
2019-11-20 13:47:15 +13:00
Hamish Mackenzie be5ce45b31 Exclude pre/postCheck from all used by shellFor (#306)
Without this fix `shellFor` fails for packages where a component has
a `preCheck` or `postCheck` option set.  It should be safe to exclude
these because `shellFor` uses `phases = ["installPhase"]` and it seems
like a bad idea to use `all` for running tests (better to run the
individual `tests` components).
2019-11-08 21:01:47 +13:00
Hamish Mackenzie a5f9f45922 Test setup deps issue depending on ghc and Cabal (#278)
Projects like asterius and leksah that include dependencies on ghc. Sometimes the are needed by a setup.hs file (as is the case for the binaryen package used by asterius). The recent overlays merge broke this and #279 was needed to allow reinstallableLibGhc to be used to fix it. This PR adds a test case to make sure it is not inadvertently broken again. Also gives us a place to try out better ways to make this type of package work.* Test setup deps issue depending on ghc and Cabal

* Uses nixpkgs 19.09 + macOS wine fix on hydra/buildkite

* Enables macOS hydra tests

* disables musl tests for now

* Adds haskellNixRoots to tests

* Uses reinstallableLibGhc to fix the new setup-depends test

* Adds meta.platforms to haskell.nix components

* Set meta.platforms on cabal-install

* Builds some maintainer-scripts on hydra

* Pins hackage index-state for ghc-extra-packages
2019-11-01 12:34:10 +13:00
Hamish Mackenzie e15c59ba2e Give more control over the compilation of Setup.hs (#277)
Allows adding of overrides through package.components.setup.
I need this to specify frameworks that Setup.hs needs on macOS.
2019-10-31 19:15:07 +13:00
Hamish Mackenzie 147cf21341 Add ghcOptions on packages (#257)
* Add `ghcOptions` with example and docs
2019-10-13 14:19:59 +08:00
Hamish Mackenzie fdcb2da2a8 Add default for shellFor packages (#242)
Uses the `isLocal` for property set by `plan-to-nix` and `stack-to-nix`
on packages where the source is referenced in the `cabal.project`
or `stack.yaml` file.
2019-10-01 11:10:11 +13:00
Hamish Mackenzie 6f566a6d5d Filter components using buildable flag (#240)
* Filter components using buildable flag

* Bump nix-tools

* Include components without buildable flag

* Test buildable components are filtered correctly
2019-09-26 13:47:03 +08:00
Hamish Mackenzie 0366537651 Use new cleanSourceWith to filter component source (#209)
When trying to build haskell packages from local source using nix (
source code you have used `git clone` to retrieve and have modified)
it is often annoying that small changes can trigger a lot of components
to be built unnecessarily.  For instance if you change the code for
a test in a package it will often trigger builds of the library and
all its dependencies.

To avoid this problem we could manually set up `cleanSourceWith` calls
in nix to filter out files that are not need, but to do this every
component would be difficult and error prone.

This change automates this process using the information in the
packages `.cabal` file to filter the source of each component
automatically  when using `callCabalPlanToNix` (we should be able to
add it to `callStackToNix` too).

## How does it work?

* A new version on `cleanSourceWith` is used that adds a `subDir`
  argument.  It allows descending into a subdirectory to compose with
  cleaning the source.

* A new `--full` argument is passed to `plan-to-nix` by
  `callCabalPlanToNix` telling it to output extra information about
  the cabal packages in the plan (directories and filenames).

* `callCabalProjectToNix` uses the new `subDir` argument of
  `cleanSourceWith` when setting the packageSrc.

* `comp-builder.nix` and `setup-builder.nix` use a new
  `cleanCabalComponent` function to further clean the packageSrc
  using the new information in the `package` and `component`.

## hpack wildcards
`package.yaml` files can include wild cards and these are not handled
yet (they do not map to anything in the `.cabal` file and so are lost).
They will need to be added manually to the appropriate field
(eg. `packages.xyz.package.dataFiles`)

If your hpack file does not contain wildcards or if you are willing to
add the wildcards entries manually in nix it is still useful to
enable cleaning on hpack.

For example:

```
packages.ghc-toolkit.package.cleanHpack = true;
packages.ghc-toolkit.components.library.extraSrcFiles = [
  "genapply/**/**"
  "boot-libs/**/**"
  "ghc-libdir/**/**"
  ];
```
2019-08-26 12:27:47 +02:00
Rupert Horlick 26c5b7be76 Add hooks to all components (#158) 2019-06-02 21:13:32 +08:00
Moritz Angermann 4bc838cc86 Unbreak build-tools (#136) 2019-05-20 18:09:28 +08:00
Hamish Mackenzie 7b438d8d74 Add more pkgconf mappings (#126) 2019-05-17 15:59:05 +08:00
Moritz Angermann 0de60e8b0c reinstallable lib:ghc and option inheritance (#88)
- reinstallable lib:ghc
- adds global options and option inheritance.
2019-03-18 21:20:33 +08:00
Moritz Angermann 696f22d87f Support library-less cabal files. 2019-03-15 10:39:01 +08:00
Will Fancher de6a254d0f Remove self from depends of "all" component in the module system
Much cleaner to do this in the definition of `all`, rather than adding
special logic elsewhere.
2019-02-20 16:17:44 +08:00
Rodney Lorrimar d1457606ed builder: Add haddock and hoogle to components.library.doc 2019-02-12 12:44:10 +10:00
Will Fancher 70f01c2029 Use mkForce in with-package test, and add a comment about the quirk. 2019-02-04 16:23:29 +08:00
Will Fancher 17ead947b0 Use config to set componentType defaults. 2019-02-04 16:23:29 +08:00
Will Fancher a7568a0e77 Use mkmerge for the all component. [Fixes #42] 2019-02-04 16:23:29 +08:00
Rodney Lorrimar 57049091b3 Fix dependency merging of "all" component 2019-01-31 13:17:45 +10:00
Rodney Lorrimar 20226fa294 builder: Add nix-shell development environments 2019-01-30 15:38:38 +10:00
Rodney Lorrimar 73f3733a2f Add an "all" component 2019-01-30 15:25:17 +10:00
Moritz Angermann 4050450b86 Allow patches to optionally depend on version and revision
This allows us to patch hackage packages to match those as shipped
with ghc; which we sadly have to.
2019-01-18 15:45:56 +08:00
Moritz Angermann 11a4b5e84c Allow configureFlags at package level 2018-12-22 22:59:40 +08:00
Moritz Angermann 03026b7bb9 Adds cabal-generator 2018-12-11 09:15:28 +08:00
Moritz Angermann 6cf6e943c0 add more cross and docrosscheck logic 2018-12-10 15:47:51 +08:00
Moritz Angermann 34bf8d224a Move copy logic from test to install 2018-11-30 18:11:35 +08:00
Moritz Angermann 9151dff3f3 Adds hooks 2018-11-26 17:26:18 +08:00
Moritz Angermann 5838e54278 Make sure we don't flood libraries with RPATHs on macOS 2018-11-18 16:18:56 +08:00
Moritz Angermann 9e804c6703 Update package.nix 2018-11-08 15:32:51 +08:00
Moritz Angermann 660cfbb3f7 make the stack logic work ... 2018-11-08 15:30:54 +08:00
Moritz Angermann ce32200e5c Update package.nix 2018-11-05 17:19:07 +08:00
Moritz Angermann 4437439f0e Add support for pathes
That is setting

```nix
{
  packages.$pkg.patches = [ ... ];
}
```

to set patches on a package.
2018-11-05 17:19:07 +08:00
Will Fancher 1bb2a42d3a Option for exact-config 2018-11-03 21:41:28 +08:00
Will Fancher d18913eaa6 Use NixOS module system 2018-11-01 13:33:41 +08:00