Commit Graph
22 Commits
Author SHA1 Message Date
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
Rodney Lorrimar d4869aab48 Add haskellLib.collectComponents (#224) 2019-08-24 10:29:43 +02:00
Moritz Angermann ebb22334d5 Adds hackage-package. (#205)
* Adds `stackage-lts-set` and `hackage-package`.

This allows us to build a full stackage-lts-set, or a package from
hackage.

```
nix build '(with import ./. {}; (hackage-package { name = "lens"; version = "4.17.1"; })).components.library'
```
would build the lens library.

```
nix build '(with import ./. {}; (stackage-lts-set "lts-13.28")).lens.components.library'
```
would build the lens library component from the lts-13.28 stackage set.

* Drop lts-stackage-set

* Adds some docs
2019-07-15 20:47:02 +08:00
Stefan Matting b0a7f89256 Add documentation on howto Hoogle (#203) 2019-07-14 13:06:47 +08:00
Rodney Lorrimar 234e9e091d docs: Add some information about mapping non-Haskell dependencies (#200)
Relates to #198
2019-07-13 17:54:53 +10:00
Rodney Lorrimar 3bb58214f1 Add cross-compiled musl libc builds of tests (#157)
* Add cross-compiled musl libc builds of tests

* Bump nixpkgs to latest 19.03

* tests: Update stack-simple LTS

* docs: Add note about tests

* Regenerate tests

* haskellPackages: lts-13.18 -> lts-13.26

This contains GHC 8.6.5 which can successfully build under
pkgsCross.musl64, whereas GHC 8.6.4 could not.

* Bump nix-tools

* Regenerate nix-tools -- changed compiler from GHC 8.6.4 -> GHC 8.6.5.
2019-07-02 18:25:40 +10:00
Moritz Angermann 2c24da0baa Update projects.md 2019-06-25 11:54:53 +02:00
Aycan iRiCAN 866ac2363b docs: Replace misplaced semicolon with colon (#185) 2019-06-21 08:57:07 +10:00
Rodney Lorrimar e15f235319 More documentation (#179)
* docs: Fix notes about .nix-tools.cache

Relates to #57

* docs: Add note about Cabal 2.4 requirement

Fixes #164

* docs: Autogenerate module option reference

* docs: Update library reference

* Buildkite: enable docs build on branches
2019-06-15 07:11:52 +02:00
Rodney Lorrimar b4b18edeec Docs improvements (#171)
- Dev note about nixpkgs pin
- More information about selecting a GHC version for cabal projects
- A little bit more information about cross compiling, but this is still incomplete.
2019-06-12 10:18:38 +10:00
Rodney Lorrimar 3747f54357 Update the docs (#165)
The docs are not complete yet, but we can start improving them from here.
2019-06-07 14:46:44 +10:00
Rodney Lorrimar caf1f61267 Use release-lib.nix for Hydra (#161)
* Use release-lib.nix for Hydra jobset

* Buildkite: Add a script to check Hydra evaluation
2019-06-03 11:26:28 +08:00
Moritz Angermann d498460394 Update docs (#107) 2019-05-07 15:33:14 +08:00
Moritz Angermann 8ee6fcfba7 Rename pkg-def-overlays to pkg-def-extras (#79)
* Rename pkg-def-overlays to pkg-def-extras

Fixes #75
2019-03-15 11:10:57 +08:00
Rodney Lorrimar e68e3178d2 docs: Add instructions for installing nix-tools (#87)
* docs: Fix some sentences in the introduction

* docs: Add instructions for installing nix-tools
Resolves #85

* docs: Add IRC channel to readme
Because our documentation isn't perfect yet, users are likely to have
questions.
2019-03-13 15:44:37 +08:00
Rodney Lorrimar a3c51fa49e docs: Update import instructions in user guide 2019-02-28 09:27:59 +10:00
Rodney Lorrimar fa7d436635 Merge pull request #73 from input-output-hk/rvl/fix-68
docs: Fix mistake in cabal instructions and update stack-to-nix usage
2019-02-27 09:09:43 +10:00
Moritz Angermann cda3b85fc0 More docs (#64) 2019-02-26 23:54:57 +08:00
Rodney Lorrimar 414bcabcca docs: Update stack-to-nix usage
It changed in input-output-hk/nix-tools#29.

Closes #72
2019-02-26 12:49:50 +10:00
Rodney Lorrimar 2956c80f98 docs: Fix small mistake in cabal instructions
Closes #68
2019-02-26 11:31:56 +10:00
Kirill Zaborsky bfbbbd30be Fix dependency name 2019-02-25 13:13:12 +03:00
Moritz Angermann 79a704960e Adds documentation (#46)
* Adds documentation
2019-02-22 10:54:07 +08:00