on iko/ghcjs-patch-master help sign in
Add `otherShells` arg to `shellFor` (#937)
e729389Hamish Mackenzie
builder/shell-for.nix+5−2
@@ -20,6 +20,7 @@
20, withHoogle ? true
20, withHoogle ? true
21, exactDeps ? false
21, exactDeps ? false
22, tools ? {}
22, tools ? {}
23+, otherShells ? [] # List of other shells to include in this one
23, ... } @ args:
24, ... } @ args:
24
25
25let
26let
@@ -116,18 +117,20 @@ let
116 }
117 }
117 ));
118 ));
118
119
119− mkDrvArgs = builtins.removeAttrs args ["packages" "additional" "withHoogle" "tools"];
120+ mkDrvArgs = builtins.removeAttrs args ["packages" "additional" "withHoogle" "tools" "otherShells"];
120in
121in
121 stdenv.mkDerivation (mkDrvArgs // {
122 stdenv.mkDerivation (mkDrvArgs // {
122 name = mkDrvArgs.name or name;
123 name = mkDrvArgs.name or name;
123
124
124 buildInputs = systemInputs
125 buildInputs = systemInputs
125 ++ mkDrvArgs.buildInputs or []
126 ++ mkDrvArgs.buildInputs or []
126− ++ lib.optional withHoogle' hoogleIndex;
127+ ++ lib.optional withHoogle' hoogleIndex
128+ ++ lib.concatMap (s: s.buildInputs) otherShells;
127 nativeBuildInputs = [ ghcEnv ]
129 nativeBuildInputs = [ ghcEnv ]
128 ++ nativeBuildInputs
130 ++ nativeBuildInputs
129 ++ mkDrvArgs.nativeBuildInputs or []
131 ++ mkDrvArgs.nativeBuildInputs or []
130 ++ lib.attrValues (buildPackages.haskell-nix.tools compiler.nix-name tools)
132 ++ lib.attrValues (buildPackages.haskell-nix.tools compiler.nix-name tools)
133+ ++ lib.concatMap (s: s.nativeBuildInputs) otherShells
131 # If this shell is a cross compilation shell include
134 # If this shell is a cross compilation shell include
132 # wrapper script for running cabal build with appropriate args.
135 # wrapper script for running cabal build with appropriate args.
133 ++ lib.optional (ghcEnv.targetPrefix != "") (
136 ++ lib.optional (ghcEnv.targetPrefix != "") (
changelog.md+1
@@ -4,6 +4,7 @@ that will impact users.
4## Nov 24, 2020
4## Nov 24, 2020
5* Added `${targetPrefix}cabal` wrapper script for running cross
5* Added `${targetPrefix}cabal` wrapper script for running cross
6 compilers in `shellFor`.
6 compilers in `shellFor`.
7+* `otherShells` arg added to `shellFor`.
7
8
8## Oct 31, 2020
9## Oct 31, 2020
9* Passing `tools.hoogle` to `shellFor` with a value suitable for `haskel-nix.tool` will
10* Passing `tools.hoogle` to `shellFor` with a value suitable for `haskel-nix.tool` will
docs/reference/library.md+1
@@ -428,6 +428,7 @@ shellFor =
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"; }; }`. 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. |
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+| `otherShells | List | List of other shells to include in this one. The `buildInputs` and `nativeBuildInputs` of each will be included.
431| `{ ... }` | Attrset | All the other arguments are passed to [`mkDerivation`](https://nixos.org/nixpkgs/manual/#sec-using-stdenv). |
432| `{ ... }` | Attrset | All the other arguments are passed to [`mkDerivation`](https://nixos.org/nixpkgs/manual/#sec-using-stdenv). |
432
433
433**Return value**: a derivation
434**Return value**: a derivation