on iko/ghcjs-patch-master help sign in
This adds logic to better support stackage (stack-to-nix)

When using stackage as a baseline via stack-to-nix, we usually assume stackage to be the base, and some augemnetation via extra-dependencies and packages in the `stack.yaml` file. To achive this we extend the package-set builder by allowing a list of additional sets of package to speicied. These are then folded onto the base package set. As stackage seems to define the `rts` package as well, we force `rts-1.0` to be null ontop of our hackage database. As of today (November 7th, 2018) there is no way of building the rts outside of GHC; and as such no way to ever get the rts package onto hackage. Once this package is *on* hackage, we can drop the hack.

commitf7c010387be7b81ab874b3d7dd8c402ff92d9c69 authorMoritz Angermann <moritz.angermann@gmail.com> dateWed 7 Nov 2018, 15:17 (8 years ago) parent660cfbb
3 files changed+19−5
default.nix+1−1 modules/hackage.nix+5−1 new-package-set.nix+13−3
default.nix+1−1
@@ -4,5 +4,5 @@ hackage: let haskell = {
44 # The *new* pkg set is one that build components.
55 # This also uses the module system for much greater extensibility.
66 # To make extend and override things, pass a modules argument to new-package-set.nix
7− mkNewPkgSet = { pkgs, pkg-def, modules ? [] }: import ./new-package-set.nix { inherit hackage pkgs pkg-def modules; };
7+ mkNewPkgSet = { pkgs, pkg-def, pkg-def-overlays ? [], modules ? [] }@args: import ./new-package-set.nix (args // { inherit hackage; });
88}; in haskell
modules/hackage.nix+5−1
@@ -76,5 +76,9 @@ in {
7676 options.hackage.configs = lib.mkOption {
7777 type = lib.types.unspecified;
7878 };
79− config.hackage.configs = hackageConfigs;
79+ # Note: we inject rts."1.0" as invalid here. This package can only
80+ # be built by GHC's build system. However it may show up in stackage
81+ # snapshots. As such we just null it out.
82+ config.hackage.configs = hackageConfigs
83+ // { rts."1.0".revisions.default = null; };
8084}
new-package-set.nix+13−3
@@ -1,5 +1,5 @@
1−let f = { hackage, pkgs, pkg-def, modules ? [] }: let
2− buildModules = f { inherit hackage pkg-def modules; pkgs = pkgs.buildPackages; };
1+let f = { hackage, pkgs, pkg-def, pkg-def-overlays ? [], modules ? [] }: let
2+ buildModules = f { inherit hackage pkg-def pkg-def-overlays modules; pkgs = pkgs.buildPackages; };
33in pkgs.lib.evalModules {
44 modules = modules ++ [
55 ({ lib, ... }: {
@@ -22,7 +22,17 @@ in pkgs.lib.evalModules {
2222 hackage.db = hackage;
2323
2424 # Set the plan for modules/plan.nix
25− plan.pkg-def = pkg-def;
25+ plan.pkg-def = hackage: with builtins;
26+ # fold any potential `pkg-def-overlays`
27+ # onto the `pkg-def`.
28+ #
29+ # This means you can have a base definition (e.g. stackage)
30+ # and augment it with custom packages to your liking.
31+ foldl' lib.recursiveUpdate
32+ (pkg-def hackage)
33+ (map (p: p hackage) pkg-def-overlays)
34+ ;
35+
2636 })
2737
2838 # Supplies metadata