on iko/ghcjs-patch-master help sign in
Add appendModule function to projects. (#1240)
749a7dcJean-Baptiste Giraudeau
docs/reference/library.md+3−2
@@ -144,7 +144,7 @@ Then feeding its result into [mkStackPkgSet](#mkstackpkgset) passing also
144| `hsPkgs` | Attrset of [Haskell Packages](#haskell-package) | Buildable packages, created from `packages` |
144| `hsPkgs` | Attrset of [Haskell Packages](#haskell-package) | Buildable packages, created from `packages` |
145| `stack-nix` | | `projectNix` attribute of [`callStackToNix`](#callstacktonix) return value |
145| `stack-nix` | | `projectNix` attribute of [`callStackToNix`](#callstacktonix) return value |
146| `shellFor` | Function | [`shellFor`](#shellfor) |
146| `shellFor` | Function | [`shellFor`](#shellfor) |
147−| `ghcWithHoogle` | Function | [`ghcWithHoogle`](#ghcwithhoogle) |
147+| `ghcWithHoogle` | Function | [`ghcWithHoogle`](#ghcwithhoogle) |
148| `ghcWithPackages` | Function | [`ghcWithPackages`](#ghcwithpackages) |
148| `ghcWithPackages` | Function | [`ghcWithPackages`](#ghcwithpackages) |
149
149
150
150
@@ -163,9 +163,10 @@ Then feeding its result into [mkCabalProjectPkgSet](#mkcabalprojectpkgset) passi
163| `plan-nix` | | `projectNix` attribute of [`callCabalProjectToNix`](#callcabalprojecttonix) return value |
163| `plan-nix` | | `projectNix` attribute of [`callCabalProjectToNix`](#callcabalprojecttonix) return value |
164| `index-state` | | `index-state` attribute of [`callCabalProjectToNix`](#callcabalprojecttonix) return value |
164| `index-state` | | `index-state` attribute of [`callCabalProjectToNix`](#callcabalprojecttonix) return value |
165| `shellFor` | Function | [`shellFor`](#shellfor) |
165| `shellFor` | Function | [`shellFor`](#shellfor) |
166−| `ghcWithHoogle` | Function | [`ghcWithHoogle`](#ghcwithhoogle) |
166+| `ghcWithHoogle` | Function | [`ghcWithHoogle`](#ghcwithhoogle) |
167| `ghcWithPackages` | Function | [`ghcWithPackages`](#ghcwithpackages) |
167| `ghcWithPackages` | Function | [`ghcWithPackages`](#ghcwithpackages) |
168| `projectCross` | Attrset | Like `pkgs.pkgsCross.<system>` from nixpkgs `p.projectCross.<system>` returns the project results for cross compilation (where system is a member of nixpkgs lib.systems.examples). So `p.projectCross.ghcjs.hsPkgs` is the same as `hsPkgs` but compiled with ghcjs |
168| `projectCross` | Attrset | Like `pkgs.pkgsCross.<system>` from nixpkgs `p.projectCross.<system>` returns the project results for cross compilation (where system is a member of nixpkgs lib.systems.examples). So `p.projectCross.ghcjs.hsPkgs` is the same as `hsPkgs` but compiled with ghcjs |
169+| `appendModule` | Function | Re-eval the project with an extra module (or module list). |
169
170
170## project, cabalProject and stackProject
171## project, cabalProject and stackProject
171
172
overlays/haskell.nix+9
@@ -577,6 +577,15 @@ final: prev: {
577 rawProject.projectFunction pkgs.haskell-nix rawProject.projectModule
577 rawProject.projectFunction pkgs.haskell-nix rawProject.projectModule
578 ) final.pkgsCross) // { recurseForDerivations = false; };
578 ) final.pkgsCross) // { recurseForDerivations = false; };
579
579
580+ # re-eval this project with an extra module (or module list).
581+ appendModule = extraProjectModule: rawProject.projectFunction final.haskell-nix
582+ ((if builtins.isList rawProject.projectModule
583+ then rawProject.projectModule
584+ else [rawProject.projectModule])
585+ ++ (if builtins.isList extraProjectModule
586+ then extraProjectModule
587+ else [extraProjectModule]));
588+
580 # Add support for passing in `crossPlatforms` argument.
589 # Add support for passing in `crossPlatforms` argument.
581 # crossPlatforms is an easy way to include the inputs for a basic
590 # crossPlatforms is an easy way to include the inputs for a basic
582 # cross platform shell in a native shell.
591 # cross platform shell in a native shell.