on 147cf21 help sign in
haskell.nix/modules/component-driver.nix
58 lines 2.2 kB history raw
1{ config, pkgs, lib, haskellLib, buildModules, ... }:
2let
3 builder = haskellLib.weakCallPackage pkgs ../builder {
4 inherit haskellLib;
5 ghc = config.ghc.package;
6 buildGHC = buildModules.config.ghc.package;
7 inherit (config) nonReinstallablePkgs hsPkgs;
8 };
10in
13 options.nonReinstallablePkgs = lib.mkOption {
14 type = lib.types.listOf lib.types.str;
15 };
16 options.reinstallableLibGhc = lib.mkOption {
17 type = lib.types.bool;
18 default = false;
19 description = "Is lib:ghc reinstallable?";
20 };
22 # Dependencies (with reinstallable-lib:ghc)
23 #
24 # .--------. .------------------.
25 # | pretty | < ------- | template-haskell |
26 # '--------' '------------------'
27 # v |
28 # .---------. .-------. |
29 # | deepseq | - > | array | |
30 # '---------' '-------' v
31 # v v .-------------.
32 # .----------. .----------. .------. .- | ghc-boot-th |
33 # | ghc-heap | | ghc-prim | | base |< -' '-------------'
34 # '----------' '----------' '------' .----------------.
35 # | v | | | integer-simple |
36 # | .-----. | '-- > |-------or-------|
37 # '---- > | rts | < -----' | integer-gmp |
38 # '-----' '----------------'
39 #
40 # without reinstallable-lib:ghc, this is significantly larger.
42 config.nonReinstallablePkgs =
43 [ "rts" "ghc-heap" "ghc-prim" "integer-gmp" "integer-simple" "base"
44 "deepseq" "array" "ghc-boot" "ghc-boot-th" "pretty" "template-haskell" ]
45 ++ lib.optional (!config.reinstallableLibGhc) "ghc";
47 options.hsPkgs = lib.mkOption {
48 type = lib.types.unspecified;
49 };
51 config.hsPkgs =
52 { inherit (builder) shellFor ghcWithPackages ghcWithHoogle;
53 buildPackages = buildModules.config.hsPkgs;
54 } //
55 lib.mapAttrs
56 (name: pkg: if pkg == null then null else builder.build-package pkg)
57 (config.packages // lib.genAttrs config.nonReinstallablePkgs (_: null));