mirror of
https://github.com/ilyakooo0/haskell.nix.git
synced 2024-09-20 03:18:00 +03:00
5bb6704833
This reverts the reinstallable packages to before PR #261 was merged and only flags the additional non-reinstallable packages as non-reinstallable if reinstallableLibGhc is `false`.
89 lines
3.1 KiB
Nix
89 lines
3.1 KiB
Nix
{ config, pkgs, lib, haskellLib, buildModules, ... }:
|
|
let
|
|
builder = haskellLib.weakCallPackage pkgs ../builder {
|
|
inherit haskellLib;
|
|
ghc = config.ghc.package;
|
|
inherit (config) nonReinstallablePkgs hsPkgs;
|
|
};
|
|
|
|
in
|
|
|
|
{
|
|
# this has a slightly modified option type. we will *overwrite* any previous
|
|
# setting of nonRelocatablePkgs, instead of merging them. Otherwise you
|
|
# have no chance of removing packages retroacively. We might improvie this
|
|
# by implementing a logic that would allow +xxx to be added, -xxx to be removed
|
|
# and if it's not a list of -/+ prefixed strings, be assumed to be overwriting.
|
|
# This seems ugly.
|
|
options.nonReinstallablePkgs = lib.mkOption {
|
|
type = (lib.types.listOf lib.types.str) // {
|
|
merge = loc: defs: lib.last (lib.getValues defs);
|
|
};
|
|
};
|
|
|
|
options.reinstallableLibGhc = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = false;
|
|
description = "Is lib:ghc reinstallable?";
|
|
};
|
|
|
|
# Dependencies (with reinstallable-lib:ghc)
|
|
#
|
|
# .--------. .------------------.
|
|
# | pretty | < ------- | template-haskell |
|
|
# '--------' '------------------'
|
|
# v |
|
|
# .---------. .-------. |
|
|
# | deepseq | - > | array | |
|
|
# '---------' '-------' v
|
|
# v v .-------------.
|
|
# .----------. .----------. .------. .- | ghc-boot-th |
|
|
# | ghc-heap | | ghc-prim | | base |< -' '-------------'
|
|
# '----------' '----------' '------' .----------------.
|
|
# | v | | | integer-simple |
|
|
# | .-----. | '-- > |-------or-------|
|
|
# '---- > | rts | < -----' | integer-gmp |
|
|
# '-----' '----------------'
|
|
#
|
|
# without reinstallable-lib:ghc, this is significantly larger.
|
|
|
|
config.nonReinstallablePkgs =
|
|
[ "rts" "ghc-heap" "ghc-prim" "integer-gmp" "integer-simple" "base"
|
|
"deepseq" "array" "ghc-boot-th" "pretty" "template-haskell"
|
|
# ghcjs custom packages
|
|
"ghcjs-prim" "ghcjs-th"
|
|
]
|
|
++ lib.optionals (!config.reinstallableLibGhc) [
|
|
"ghc-boot"
|
|
"ghc" "Cabal" "Win32" "array" "binary" "bytestring" "containers"
|
|
"directory" "filepath" "ghc-boot" "ghc-compact" "ghc-prim"
|
|
# "ghci" "haskeline"
|
|
"hpc"
|
|
"mtl" "parsec" "process" "text" "time" "transformers"
|
|
"unix" "xhtml"
|
|
# "stm" "terminfo"
|
|
];
|
|
|
|
options.bootPkgs = lib.mkOption {
|
|
type = lib.types.listOf lib.types.str;
|
|
};
|
|
|
|
config.bootPkgs = [
|
|
"rts" "ghc-boot-th"
|
|
"ghc-heap" # since ghc 8.6.
|
|
]
|
|
++ lib.optional (!config.reinstallableLibGhc) "ghc";
|
|
|
|
options.hsPkgs = lib.mkOption {
|
|
type = lib.types.unspecified;
|
|
};
|
|
|
|
config.hsPkgs =
|
|
{ inherit (builder) shellFor ghcWithPackages ghcWithHoogle;
|
|
buildPackages = buildModules.config.hsPkgs;
|
|
} //
|
|
lib.mapAttrs
|
|
(name: pkg: if pkg == null then null else builder.build-package pkg)
|
|
(config.packages // lib.genAttrs (config.nonReinstallablePkgs ++ config.bootPkgs) (_: null));
|
|
}
|