Skip to content

Commit 81d2cb8

Browse files
committed
Revert "Remove old code"
This reverts commit 2922479.
1 parent 2922479 commit 81d2cb8

File tree

6 files changed

+68
-5
lines changed

6 files changed

+68
-5
lines changed

compiler/ghc/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ let
274274
then ../../materialized/${compiler-nix-name}/hadrian-ghc98
275275
else ../../materialized/${compiler-nix-name}/hadrian-ghc99;
276276
modules = [{
277+
reinstallableLibGhc = false;
277278
# Apply the patches in a way that does not require using something
278279
# like `srcOnly`. The problem with `pkgs.srcOnly` was that it had to run
279280
# on a platform at eval time.

modules/component-driver.nix

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ in
2626
merge = _loc: defs: lib.last (lib.getValues defs);
2727
};
2828
};
29+
30+
options.reinstallableLibGhc = lib.mkOption {
31+
type = lib.types.bool;
32+
default = !pkgs.stdenv.hostPlatform.isGhcjs;
33+
description = "Is lib:ghc reinstallable?";
34+
};
2935
options.setup-depends = lib.mkOption {
3036
type = lib.types.listOf lib.types.unspecified;
3137
default = [];
@@ -52,10 +58,42 @@ in
5258
#
5359
# without reinstallable-lib:ghc, this is significantly larger.
5460

55-
config.nonReinstallablePkgs =
56-
["rts"] ++ config.preExistingPkgs
57-
++ lib.optionals (builtins.compareVersions config.compiler.version "8.11" < 0 && pkgs.stdenv.hostPlatform.isGhcjs) [
58-
"ghcjs-prim" "ghcjs-th"];
61+
config.nonReinstallablePkgs = if config.preExistingPkgs != []
62+
then ["rts"] ++ config.preExistingPkgs
63+
++ lib.optionals (builtins.compareVersions config.compiler.version "8.11" < 0 && pkgs.stdenv.hostPlatform.isGhcjs) [
64+
"ghcjs-prim" "ghcjs-th"]
65+
else
66+
[ "rts" "ghc-prim" "integer-gmp" "integer-simple" "base"
67+
"deepseq" "array" "ghc-boot-th" "pretty" "template-haskell"
68+
# ghcjs custom packages
69+
"ghcjs-prim" "ghcjs-th"
70+
]
71+
++ lib.optionals (builtins.compareVersions config.compiler.version "8.11" >= 0) [
72+
"ghc-bignum"]
73+
++ lib.optionals (builtins.compareVersions config.compiler.version "9.1" >= 0) [
74+
"system-cxx-std-lib"]
75+
++ lib.optionals (builtins.compareVersions config.compiler.version "9.9" >= 0) [
76+
"ghc-internal"]
77+
++ lib.optionals (!config.reinstallableLibGhc) ([
78+
"ghc-boot"
79+
"ghc" "Cabal" "Win32" "array" "binary" "bytestring" "containers"
80+
"directory" "filepath" "ghc-boot" "ghc-compact" "ghc-prim"
81+
# "ghci" "haskeline"
82+
"hpc"
83+
"mtl" "parsec" "process" "text" "time" "transformers"
84+
"unix" "xhtml" "terminfo"
85+
]
86+
++ lib.optionals (builtins.compareVersions config.compiler.version "8.11" >= 0) [
87+
# stm and exceptions are needed by the GHC package since 9.0.1
88+
"stm" "exceptions"]
89+
++ lib.optionals (builtins.compareVersions config.compiler.version "9.8.1" >= 0) [
90+
"semaphore-compat"]
91+
++ lib.optionals (builtins.compareVersions config.compiler.version "9.9" >= 0) [
92+
"os-string"]
93+
)
94+
++ lib.optionals (!config.reinstallableLibGhc || __elem config.compiler.nix-name ["ghc865"]) [
95+
"ghc-heap"
96+
];
5997

6098
options.bootPkgs = lib.mkOption {
6199
type = lib.types.listOf lib.types.str;
@@ -64,7 +102,7 @@ in
64102
config.bootPkgs = [
65103
"rts" "ghc-boot-th"
66104
"ghcjs-prim"
67-
] ++ lib.optional (builtins.elem "ghc" config.preExistingPkgs) "ghc"
105+
] ++ lib.optional (!config.reinstallableLibGhc) "ghc"
68106
++ lib.optionals (
69107
!__elem config.compiler.nix-name ["ghc865" "ghc881" "ghc882" "ghc883" "ghc884" "ghc8101" "ghc8102" "ghc8103" "ghc8104" "ghc8105" "ghc8106" "ghc8107"]) [
70108
"ghc-bignum" ]

modules/configuration-nix.nix

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,23 @@ in {
160160
pkgs.libpcap
161161
];
162162

163+
# Build ghci and ghc with internal interpreter support to make the
164+
# `reinstallableLibGhc` build more like the boot version.
165+
# See https://github.com/input-output-hk/haskell.nix/issues/1512
166+
packages.ghc.flags.ghci = true;
167+
packages.ghc.flags.internal-interpreter = true;
168+
packages.ghci.flags.ghci = true;
169+
packages.ghci.flags.internal-interpreter = true;
170+
171+
# These flags are set by hadrian. This would be fine if:
172+
# * Haskell.nix respected `pre-existing` packages in `plan.json` and used the hadrian built version.
173+
# * If `plan.json` included the flag settings used by `pre-existing` packages.
174+
# For now the work around is to set the flags that hadrian does (see hadrian/src/Settings/Packages.hs).
175+
packages.unix.flags = pkgs.lib.optionalAttrs (builtins.compareVersions config.compiler.version "9.9" > 0) { os-string = true; };
176+
packages.directory.flags = pkgs.lib.optionalAttrs (builtins.compareVersions config.compiler.version "9.9" > 0) { os-string = true; };
177+
packages.Win32.flags = pkgs.lib.optionalAttrs (builtins.compareVersions config.compiler.version "9.9" > 0) { os-string = true; };
178+
packages.hashable.flags = pkgs.lib.optionalAttrs (builtins.compareVersions config.compiler.version "9.9" > 0) { os-string = true; };
179+
163180
# See https://github.com/Bodigrim/bitvec/pull/61
164181
packages.bitvec.patches = [
165182
(fromUntil "1.1.3.0" "1.1.3.0.1" ../patches/bitvec-gmp-fix.patch)

overlays/bootstrap.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,6 +1484,7 @@ in {
14841484
version = "3.2.4";
14851485
inherit ghcOverride index-state;
14861486
materialized = ../materialized/bootstrap + "/${buildBootstrapper.compilerNixName}/alex";
1487+
modules = [{ reinstallableLibGhc = false; }];
14871488
nix-tools = config.evalPackages.haskell-nix.nix-tools;
14881489
} // args);
14891490
alex = final.haskell-nix.bootstrap.packages.alex-tool {};
@@ -1494,6 +1495,7 @@ in {
14941495
evalPackages = pkgs.buildPackages;
14951496
inherit version ghcOverride index-state;
14961497
materialized = ../materialized/bootstrap + "/${buildBootstrapper.compilerNixName}/happy-${version}";
1498+
modules = [{ reinstallableLibGhc = false; }];
14971499
nix-tools = config.evalPackages.haskell-nix.nix-tools;
14981500
} // args);
14991501
happy = final.haskell-nix.bootstrap.packages.happy-tool {};
@@ -1510,6 +1512,7 @@ in {
15101512
version = "1.24.4";
15111513
inherit ghcOverride index-state;
15121514
materialized = ../materialized/bootstrap + "/${buildBootstrapper.compilerNixName}/hscolour";
1515+
modules = [{ reinstallableLibGhc = false; }];
15131516
nix-tools = config.evalPackages.haskell-nix.nix-tools;
15141517
} // args)).getComponent "exe:HsColour";
15151518
hscolour = final.haskell-nix.bootstrap.packages.hscolour-tool {};

overlays/ghc-packages.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ in rec {
260260
configureArgs = "--disable-tests --disable-benchmarks --allow-newer='terminfo:base'"; # avoid failures satisfying bytestring package tests dependencies
261261
modules = [{
262262
packages.iserv-proxy.patches = [./patches/ghc/ghc-8.10.7-iserv-proxy-load-dlls.patch];
263+
reinstallableLibGhc = false;
263264
}];
264265
}))
265266
ghc-extra-pkgs-cabal-projects;

test/plugin/default.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ let
77
inherit compiler-nix-name evalPackages;
88
src = testSrc "plugin";
99
cabalProjectLocal = builtins.readFile ../cabal.project.local;
10+
modules = [{
11+
reinstallableLibGhc = builtins.compareVersions buildPackages.haskell-nix.compiler.${compiler-nix-name}.version "9.8.1" < 0;
12+
}];
1013
};
1114

1215
packages = project.hsPkgs;

0 commit comments

Comments
 (0)