Skip to content

Commit c83fba5

Browse files
committed
Add project.projectVariant that apply flake.variants modules
1 parent ea40f5c commit c83fba5

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

docs/reference/library.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ Then feeding its result into [mkCabalProjectPkgSet](#mkcabalprojectpkgset) passi
166166
| `ghcWithHoogle` | Function | [`ghcWithHoogle`](#ghcwithhoogle) |
167167
| `ghcWithPackages` | Function | [`ghcWithPackages`](#ghcwithpackages) |
168168
| `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+
| `projectVariant` | Attrset | Attribute set of variant for the project, mapped from `flake.variants` config values |
169170
| `appendModule` | Function | Re-eval the project with an extra module (or module list). |
170171
| `extend` and `appendOverlays` | Function | Modify a project, or add attributes, through overlays: `p.extend(final: prev: { })`. The overlays are carried-over `projectCross` and `appendModule` invocations. |
171172

overlays/haskell.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,10 @@ final: prev: {
623623
.extend project.__overlay__
624624
) final.pkgsCross) // { recurseForDerivations = false; };
625625

626+
# attribute set of variant (with an extra module applied) for the project,
627+
# mapped from `flake.variants` config values.
628+
projectVariant = final.lib.mapAttrs (_: project.appendModule) project.args.flake.variants;
629+
626630
# re-eval this project with an extra module (or module list).
627631
appendModule = extraProjectModule: (rawProject.projectFunction final.haskell-nix
628632
((if builtins.isList rawProject.projectModule

0 commit comments

Comments
 (0)