Add appendModule function to projects. (#1240)

Allow re-eval of the project with an extra module (or module list).
This commit is contained in:
Jean-Baptiste Giraudeau 2021-09-18 04:43:46 +02:00 committed by GitHub
parent c386fd6f82
commit 749a7dc068
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -144,7 +144,7 @@ Then feeding its result into [mkStackPkgSet](#mkstackpkgset) passing also
| `hsPkgs` | Attrset of [Haskell Packages](#haskell-package) | Buildable packages, created from `packages` |
| `stack-nix` | | `projectNix` attribute of [`callStackToNix`](#callstacktonix) return value |
| `shellFor` | Function | [`shellFor`](#shellfor) |
| `ghcWithHoogle` | Function | [`ghcWithHoogle`](#ghcwithhoogle) |
| `ghcWithHoogle` | Function | [`ghcWithHoogle`](#ghcwithhoogle) |
| `ghcWithPackages` | Function | [`ghcWithPackages`](#ghcwithpackages) |
@ -163,9 +163,10 @@ Then feeding its result into [mkCabalProjectPkgSet](#mkcabalprojectpkgset) passi
| `plan-nix` | | `projectNix` attribute of [`callCabalProjectToNix`](#callcabalprojecttonix) return value |
| `index-state` | | `index-state` attribute of [`callCabalProjectToNix`](#callcabalprojecttonix) return value |
| `shellFor` | Function | [`shellFor`](#shellfor) |
| `ghcWithHoogle` | Function | [`ghcWithHoogle`](#ghcwithhoogle) |
| `ghcWithHoogle` | Function | [`ghcWithHoogle`](#ghcwithhoogle) |
| `ghcWithPackages` | Function | [`ghcWithPackages`](#ghcwithpackages) |
| `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 |
| `appendModule` | Function | Re-eval the project with an extra module (or module list). |
## project, cabalProject and stackProject

View File

@ -577,6 +577,15 @@ final: prev: {
rawProject.projectFunction pkgs.haskell-nix rawProject.projectModule
) final.pkgsCross) // { recurseForDerivations = false; };
# re-eval this project with an extra module (or module list).
appendModule = extraProjectModule: rawProject.projectFunction final.haskell-nix
((if builtins.isList rawProject.projectModule
then rawProject.projectModule
else [rawProject.projectModule])
++ (if builtins.isList extraProjectModule
then extraProjectModule
else [extraProjectModule]));
# Add support for passing in `crossPlatforms` argument.
# crossPlatforms is an easy way to include the inputs for a basic
# cross platform shell in a native shell.