@@ -73,7 +73,7 @@ components = {
73 all = COMPONENT;
73 all = COMPONENT;
77## Component
77## Component
79In [Haskell.nix][], a _component_ is a derivation corresponding to a
79In [Haskell.nix][], a _component_ is a derivation corresponding to a
@@ -104,7 +104,7 @@ set. They are either:
104If using the function form of a module, the following named parameters
104If using the function form of a module, the following named parameters
105will be passed to it:
105will be passed to it:
107−| Argument | Type | Description |
107+| Argument | Type | Description |
108|------------------|------|---------------------|
108|------------------|------|---------------------|
109| `haskellLib` | attrset | The [haskellLib](#haskelllib) utility functions. |
109| `haskellLib` | attrset | The [haskellLib](#haskelllib) utility functions. |
110| `pkgs` | | The Nixpkgs collection. |
110| `pkgs` | | The Nixpkgs collection. |
@@ -126,7 +126,7 @@ mkStackPkgSet =
126 { stack-pkgs, pkg-def-extras ? [], modules ? []}: ...
126 { stack-pkgs, pkg-def-extras ? [], modules ? []}: ...
129−| Argument | Type | Description |
129+| Argument | Type | Description |
130|------------------|------|---------------------|
130|------------------|------|---------------------|
131| `stack-pkgs` | | `import ./pkgs.nix` — The imported file generated by `stack‑to‑nix`. |
131| `stack-pkgs` | | `import ./pkgs.nix` — The imported file generated by `stack‑to‑nix`. |
132| `pkg‑def‑extras` | List of [Extras](#extras) | For overriding the package set. |
132| `pkg‑def‑extras` | List of [Extras](#extras) | For overriding the package set. |
@@ -144,7 +144,7 @@ mkCabalProjectPkgSet =
144 { plan-pkgs, pkg-def-extras ? [], modules ? []}: ...
144 { plan-pkgs, pkg-def-extras ? [], modules ? []}: ...
147−| Argument | Type | Description |
147+| Argument | Type | Description |
148|------------------|------|---------------------|
148|------------------|------|---------------------|
149| `plan-pkgs` | | `import ./pkgs.nix` — The imported file generated by `plan‑to‑nix`. |
149| `plan-pkgs` | | `import ./pkgs.nix` — The imported file generated by `plan‑to‑nix`. |
150| `pkg‑def‑extras` | List of [Extras](#extras) | For overriding the package set. |
150| `pkg‑def‑extras` | List of [Extras](#extras) | For overriding the package set. |
@@ -192,6 +192,46 @@ Assorted functions for operating on [Haskell.nix][] data. This is
192distinct from `pkgs.haskell.lib` in the current Nixpkgs Haskell
192distinct from `pkgs.haskell.lib` in the current Nixpkgs Haskell
193Infrastructure.
193Infrastructure.
195+### collectComponents
197+Extracts a selection of components from a Haskell [package set](#package-set).
199+This can be used to filter out all test suites or benchmarks of
200+your project, so that they can be built in Hydra.
204+ group: packageSel: haskellPackages: ...
208+| Argument | Type | Description |
209+|-------------------|--------|---------------------|
210+| `group` | String | A [sub-component type](#subComponentTypes). |
211+| `packageSel` | A function `Package -> Bool` | A predicate to filter packages with. |
212+| `haskellPackages` | [Package set](#package-set) | All packages in the build. |
214+**Return value**: a recursive attrset mapping package names → component names → components.
219+tests = collectComponents "tests" (package: package.identifier.name == "mypackage") hsPkgs;
222+Will result in moving derivations from `hsPkgs.mypackage.components.tests.unit-tests`
223+to `tests.mypackage.unit-tests`.
225+#### subComponentTypes
227+Sub-component types identify [components](#component) and are one of:
195# Package-set functions
235# Package-set functions
197These functions exist within the `hsPkgs` package set.
237These functions exist within the `hsPkgs` package set.
@@ -208,7 +248,7 @@ shellFor =
211−| Argument | Type | Description |
251+| Argument | Type | Description |
212|----------------|------|---------------------|
252|----------------|------|---------------------|
213| `packages` | Function | Package selection function. It takes a list of [Haskell packages](#haskell-package) and returns a subset of these packages. |
253| `packages` | Function | Package selection function. It takes a list of [Haskell packages](#haskell-package) and returns a subset of these packages. |
214| `withHoogle` | Boolean | Whether to build a Hoogle documentation index and provide the `hoogle` command. |
254| `withHoogle` | Boolean | Whether to build a Hoogle documentation index and provide the `hoogle` command. |