on iko/ghcjs-patch-master help sign in
Allow for hoogle to be materialized in shellFor (#902)
0c3abc8Eric Wolf
builder/shell-for.nix+6−2
@@ -105,12 +105,16 @@ let
105 pname = p.identifier.name;
105 pname = p.identifier.name;
106 haddockDir = lib.const p.haddockDir;
106 haddockDir = lib.const p.haddockDir;
107 };
107 };
108− in hoogleLocal {
108+ in hoogleLocal ({
109 packages = map docPackage (haskellLib.flatLibDepends component);
109 packages = map docPackage (haskellLib.flatLibDepends component);
110
110
111 # Need to add hoogle to hsPkgs.
111 # Need to add hoogle to hsPkgs.
112 # inherit (hsPkgs) hoogle;
112 # inherit (hsPkgs) hoogle;
113+ } // (
114+ lib.optionalAttrs (args ? tools && args.tools ? hoogle) {
115+ hoogle = buildPackages.haskell-nix.tool compiler.nix-name "hoogle" args.tools.hoogle;
116+ }
113− };
117+ ));
114
118
115 mkDrvArgs = builtins.removeAttrs args ["packages" "additional" "withHoogle" "tools"];
119 mkDrvArgs = builtins.removeAttrs args ["packages" "additional" "withHoogle" "tools"];
116in
120in
changelog.md+5
@@ -1,6 +1,11 @@
1This file contains a summary of changes to Haskell.nix and `nix-tools`
1This file contains a summary of changes to Haskell.nix and `nix-tools`
2that will impact users.
2that will impact users.
3
3
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+
4## Oct 28, 2020
9## Oct 28, 2020
5* Passing `compiler-nix-name` to project functions for `stack.yaml`
10* Passing `compiler-nix-name` to project functions for `stack.yaml`
6 based projects now overrides the compiler used (was ignored before).
11 based projects now overrides the compiler used (was ignored before).
docs/reference/library.md+1−1
@@ -427,7 +427,7 @@ shellFor =
427| `additional` | Function | Similar to `packages`, but the selected packages are built and included in `ghc-pkg list` (not just their dependencies). |
427| `additional` | Function | Similar to `packages`, but the selected packages are built and included in `ghc-pkg list` (not just their dependencies). |
428| `withHoogle` | Boolean | Whether to build a Hoogle documentation index and provide the `hoogle` command. |
428| `withHoogle` | Boolean | Whether to build a Hoogle documentation index and provide the `hoogle` command. |
429| `exactDeps` | Boolean | Prevents the Cabal solver from choosing any package dependency other than what are in the package set. |
429| `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. |
431| `{ ... }` | Attrset | All the other arguments are passed to [`mkDerivation`](https://nixos.org/nixpkgs/manual/#sec-using-stdenv). |
431| `{ ... }` | Attrset | All the other arguments are passed to [`mkDerivation`](https://nixos.org/nixpkgs/manual/#sec-using-stdenv). |
432
432
433**Return value**: a derivation
433**Return value**: a derivation