on patch-support help sign in
haskell.nix/new-package-set.nix
55 lines 2.0 kB history raw
1let f = { hackage, pkgs, pkg-def, pkg-def-overlays ? [], modules ? [] }: let
2 buildModules = f { inherit hackage pkg-def pkg-def-overlays modules; pkgs = pkgs.buildPackages; };
3in pkgs.lib.evalModules {
4 modules = modules ++ [
5 ({ lib, ... }: {
6 # Provide all modules with haskellLib, pkgs, and pkgconfPkgs arguments
7 _module.args = {
8 # this is *not* the hasekllLib from nixpkgs; it is rather our own
9 # library from haskell.nix
10 haskellLib = let hl = import ./lib { inherit lib; haskellLib = hl; }; in hl;
12 # The package descriptions depend on pkgs, which are used to resolve system package dependencies
13 # as well as pkgconfPkgs, which are used to resolve pkgconfig name to nixpkgs names. We simply
14 # augment the existing pkgs set with the specific mappings:
15 pkgs = pkgs // (import ./lib/system-nixpkgs-map.nix pkgs);
16 pkgconfPkgs = pkgs // (import ./lib/pkgconf-nixpkgs-map.nix pkgs);
18 inherit buildModules;
19 };
21 # Set the hackage DB for modules/hackage.nix
22 hackage.db = hackage;
24 # Set the plan for modules/plan.nix
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 ;
36 })
38 # Supplies metadata
39 ./modules/cabal.nix
41 # Converts config.packages into config.hsPkgs
42 # Replace this with compat-driver.nix to use nixpkgs haskell build infra
43 ./modules/component-driver.nix
45 # Converts config.hackage.db to config.hackage.configs
46 ./modules/hackage.nix
48 # Converts config.hackage.configs and pkg-def to config.packages
49 ./modules/plan.nix
51 # Configuration that applies to all plans
52 ./modules/configuration-nix.nix
53 ];
54};
55in f