on iko/ghcjs-patch-master help sign in
Replace `otherShells` with `mkShell` `inputsFrom` (#939)
c0931c9Hamish Mackenzie
builder/shell-for.nix+4−7
@@ -1,4 +1,4 @@
1−{ lib, stdenv, glibcLocales, pkgconfig, ghcForComponent, makeConfigFiles, hsPkgs, hoogleLocal, haskellLib, buildPackages, compiler }:
1+{ lib, stdenv, mkShell, glibcLocales, pkgconfig, ghcForComponent, makeConfigFiles, hsPkgs, hoogleLocal, haskellLib, buildPackages, compiler }:
2
2
3{ # `packages` function selects packages that will be worked on in the shell itself.
3{ # `packages` function selects packages that will be worked on in the shell itself.
4 # These packages will not be built by `shellFor`, but their
4 # These packages will not be built by `shellFor`, but their
@@ -20,7 +20,6 @@
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
24, ... } @ args:
23, ... } @ args:
25
24
26let
25let
@@ -117,19 +116,17 @@ let
117 }
116 }
118 ));
117 ));
119
118
120− mkDrvArgs = builtins.removeAttrs args ["packages" "additional" "withHoogle" "tools" "otherShells"];
119+ mkDrvArgs = builtins.removeAttrs args ["packages" "additional" "withHoogle" "tools"];
121in
120in
122− stdenv.mkDerivation (mkDrvArgs // {
121+ mkShell (mkDrvArgs // {
123 name = mkDrvArgs.name or name;
122 name = mkDrvArgs.name or name;
124
123
125 buildInputs = systemInputs
124 buildInputs = systemInputs
126− ++ mkDrvArgs.buildInputs or []
125+ ++ mkDrvArgs.buildInputs or [];
127− ++ lib.concatMap (s: s.buildInputs) otherShells;
128 nativeBuildInputs = [ ghcEnv ]
126 nativeBuildInputs = [ ghcEnv ]
129 ++ nativeBuildInputs
127 ++ nativeBuildInputs
130 ++ mkDrvArgs.nativeBuildInputs or []
128 ++ mkDrvArgs.nativeBuildInputs or []
131 ++ lib.attrValues (buildPackages.haskell-nix.tools compiler.nix-name tools)
129 ++ lib.attrValues (buildPackages.haskell-nix.tools compiler.nix-name tools)
132− ++ lib.concatMap (s: s.nativeBuildInputs) otherShells
133 # If this shell is a cross compilation shell include
130 # If this shell is a cross compilation shell include
134 # wrapper script for running cabal build with appropriate args.
131 # wrapper script for running cabal build with appropriate args.
135 ++ lib.optional (ghcEnv.targetPrefix != "") (
132 ++ lib.optional (ghcEnv.targetPrefix != "") (
changelog.md+3
@@ -1,6 +1,9 @@
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+## Nov 26, 2020
5+* Renamed `otherShells` arg for `shellFor` to `inputsFrom
6+
4## Nov 25, 2020
7## Nov 25, 2020
5* The `shellFor` `makeConfigFiles` `ghcWithHoogle` and `ghcWithPackages`
8* The `shellFor` `makeConfigFiles` `ghcWithHoogle` and `ghcWithPackages`
6 functions have been removed from `project.hsPkgs`. Instead access
9 functions have been removed from `project.hsPkgs`. Instead access
docs/reference/library.md+1−1
@@ -433,7 +433,7 @@ shellFor =
433| `withHoogle` | Boolean | Whether to build a Hoogle documentation index and provide the `hoogle` command. |
433| `withHoogle` | Boolean | Whether to build a Hoogle documentation index and provide the `hoogle` command. |
434| `exactDeps` | Boolean | Prevents the Cabal solver from choosing any package dependency other than what are in the package set. |
434| `exactDeps` | Boolean | Prevents the Cabal solver from choosing any package dependency other than what are in the package set. |
435| `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. |
435| `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. |
436−| `otherShells | List | List of other shells to include in this one. The `buildInputs` and `nativeBuildInputs` of each will be included.
436+| `inputsFrom` | List | List of other shells to include in this one. The `buildInputs` and `nativeBuildInputs` of each will be included using [mkShell](https://nixos.org/manual/nixpkgs/stable/#sec-pkgs-mkShell).
437| `{ ... }` | Attrset | All the other arguments are passed to [`mkDerivation`](https://nixos.org/nixpkgs/manual/#sec-using-stdenv). |
437| `{ ... }` | Attrset | All the other arguments are passed to [`mkDerivation`](https://nixos.org/nixpkgs/manual/#sec-using-stdenv). |
438
438
439**Return value**: a derivation
439**Return value**: a derivation