on iko/ghcjs-patch-master help sign in
Allow for hoogle to be materialized in shellFor (#902)

Allow for hoogle to be materialized in `shellFor` by using `tools.hoogle` when passed in. Co-authored-by: Hamish Mackenzie <Hamish.K.Mackenzie@googlemail.com>

commit0c3abc8a6d579b1ef2b99e53541c01f08ceb36a2 authorEric Wolf <1983821+typetetris@users.noreply.github.com> dateSat 31 Oct 2020, 08:46 (6 years ago) parent5ed1694
3 files changed+12−3
builder/shell-for.nix+6−2 changelog.md+5 docs/reference/library.md+1−1
builder/shell-for.nix+6−2
@@ -105,12 +105,16 @@ let
105105 pname = p.identifier.name;
106106 haddockDir = lib.const p.haddockDir;
107107 };
108− in hoogleLocal {
108+ in hoogleLocal ({
109109 packages = map docPackage (haskellLib.flatLibDepends component);
110110
111111 # Need to add hoogle to hsPkgs.
112112 # inherit (hsPkgs) hoogle;
113− };
113+ } // (
114+ lib.optionalAttrs (args ? tools && args.tools ? hoogle) {
115+ hoogle = buildPackages.haskell-nix.tool compiler.nix-name "hoogle" args.tools.hoogle;
116+ }
117+ ));
114118
115119 mkDrvArgs = builtins.removeAttrs args ["packages" "additional" "withHoogle" "tools"];
116120in
changelog.md+5
@@ -1,6 +1,11 @@
11This file contains a summary of changes to Haskell.nix and `nix-tools`
22that will impact users.
33
4+## Oct 31, 2020
5+* Passing `tools.hoogle` to `shellFor` with a value suitable for `haskel-nix.tool` will
6+ use the specified `hoogle` inside `shellFor`. This allows for materialization
7+ of `hoogle`.
8+
49## Oct 28, 2020
510* Passing `compiler-nix-name` to project functions for `stack.yaml`
611 based projects now overrides the compiler used (was ignored before).
docs/reference/library.md+1−1
@@ -427,7 +427,7 @@ shellFor =
427427| `additional` | Function | Similar to `packages`, but the selected packages are built and included in `ghc-pkg list` (not just their dependencies). |
428428| `withHoogle` | Boolean | Whether to build a Hoogle documentation index and provide the `hoogle` command. |
429429| `exactDeps` | Boolean | Prevents the Cabal solver from choosing any package dependency other than what are in the package set. |
430−| `tools` | Function | AttrSet of tools to make available e.g. `{ cabal = "3.2.0.0"; }` or `{ cabal = { version = "3.2.0.0"; }; }` |
430+| `tools` | Function | AttrSet of tools to make available e.g. `{ cabal = "3.2.0.0"; }` or `{ cabal = { version = "3.2.0.0"; }; }`. If an AttrSet is provided for a tool, the additional arguments will be passed to the function creating the derivation for that tool. So you can provide an `index-state` or a `materialized` argument like that `{ cabal = { version = "3.2.0.0"; index-state = "2020-10-30T00:00:00Z"; materialized = ./cabal.materialized; }; }` for example. You can specify and materialize the version of hoogle used to construct the hoogle index by including something like `{ hoogle = { version = "5.0.17.15"; index-state = "2020-05-31T00:00:00Z"; materialized = ./hoogle.materialized; }`. Uses a default version of hoogle if omitted. |
431431| `{ ... }` | Attrset | All the other arguments are passed to [`mkDerivation`](https://nixos.org/nixpkgs/manual/#sec-using-stdenv). |
432432
433433**Return value**: a derivation