Skip to content

Commit bb4f8de

Browse files
committed
Use ghc from nixpkgs
1 parent 098bbc8 commit bb4f8de

File tree

8 files changed

+175
-94
lines changed

8 files changed

+175
-94
lines changed

compiler/ghc-configure-src/default.nix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ let self =
7575
, src-spec
7676
, ghc-patches ? []
7777
, hadrian
78+
, ghc
7879

7980
# extra values we want to have available as passthru values.
8081
, extra-passthru ? {}
@@ -421,7 +422,8 @@ stdenv.mkDerivation (rec {
421422
dontAddExtraLibs = true;
422423

423424
nativeBuildInputs = [
424-
perl autoconf automake m4 python3 sphinx
425+
perl autoconf automake m4 python3 sphinx autoreconfHook
426+
ghc
425427
] ++ lib.optional (patches != []) autoreconfHook;
426428

427429
# For building runtime libs

modules/component-driver.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ in
2424

2525
options.reinstallableLibGhc = lib.mkOption {
2626
type = lib.types.bool;
27-
default = true;
27+
default = false;
2828
description = "Is lib:ghc reinstallable?";
2929
};
3030
options.setup-depends = lib.mkOption {
@@ -91,7 +91,7 @@ in
9191
};
9292

9393
config.bootPkgs = [
94-
"rts" "ghc-boot-th"
94+
"rts" "ghc-boot-th" "ghc-boot" "ghc-heap" "ghci"
9595
"ghcjs-prim"
9696
] ++ lib.optional (!config.reinstallableLibGhc) "ghc"
9797
++ lib.optionals (

modules/plan.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,6 @@ in
7272
m // { flags = lib.mapAttrs (_: lib.mkDefault) (m.flags // revArgs.flags or {});
7373
}
7474
) (lib.filterAttrs (_n: v: v == null || v.revision != null ) module.packages);
75+
# ) (lib.filterAttrs (_n: v: v == null || (v.revision != null && v.revision != {})) module.packages);
7576
};
7677
}

nix-tools/t

Lines changed: 0 additions & 40 deletions
This file was deleted.

overlays/bootstrap.nix

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ in {
2626
resolve-compiler-name = name: final.haskell-nix.compilerNameMap.${name} or name;
2727
# Use this to disable the existing haskell infra structure for testing purposes
2828
compiler = {
29-
ghc982 = final.haskell.compiler.ghc982.overrideAttrs (prevAttrs: rec {
29+
ghc982 = final.haskell.compiler.ghc982.overrideAttrs (prevAttrs: {
3030
passthru = prevAttrs.passthru // {
3131
configured-src =
3232
(final.callPackage ../compiler/ghc-configure-src ({
@@ -38,7 +38,8 @@ in {
3838
url = "https://downloads.haskell.org/~ghc/${version}/ghc-${version}-src.tar.xz";
3939
sha256 = "sha256-4vt6fddGEjfSLoNlqD7dnhp30uFdBF85RTloRah3gck=";
4040
};
41-
hadrian = prevAttrs.hadrian;
41+
hadrian = prevAttrs.passthru.hadrian;
42+
ghc = final.haskell.compiler.ghc982;
4243
})).passthru.configured-src;
4344
};
4445
});

overlays/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ let
110110
bootstrap
111111
compiler-llvm
112112
# ghc
113-
ghc-packages
113+
# ghc-packages
114114
darwin
115115
windows
116116
armv6l-linux

overlays/ghc-packages.nix

Lines changed: 163 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -141,48 +141,48 @@ in rec {
141141
ghc-boot-packages-src-and-nix = builtins.mapAttrs
142142
(ghcName: ghc: builtins.mapAttrs
143143
(pkgName: subDir: rec {
144-
src =
145-
# TODO remove once nix >=2.4 is widely adopted (will trigger rebuilds of everything).
146-
# See https://github.com/input-output-hk/haskell.nix/issues/1459
147-
let nix24srcFix = src: src // { filterPath = { path, ... }: path; };
148-
# Add in the generated files needed by ghc-boot
149-
in if subDir == "libraries/ghc-boot"
150-
then nix24srcFix (final.buildPackages.runCommand "ghc-boot-src" { nativeBuildInputs = [final.buildPackages.xorg.lndir]; } ''
151-
mkdir $out
152-
lndir -silent ${ghc.passthru.configured-src}/${subDir} $out
153-
lndir -silent ${ghc.generated}/libraries/ghc-boot/dist-install/build/GHC $out/GHC
154-
'')
155-
else if subDir == "compiler"
156-
then final.haskell-nix.haskellLib.cleanSourceWith {
157-
src = nix24srcFix (final.buildPackages.runCommand "ghc-src" { nativeBuildInputs = [final.buildPackages.xorg.lndir]; } ''
158-
mkdir $out
159-
lndir -silent ${ghc.passthru.configured-src} $out
160-
if [[ -f ${ghc.generated}/libraries/ghc-boot/dist-install/build/GHC/Version.hs ]]; then
161-
ln -s ${ghc.generated}/libraries/ghc-boot/dist-install/build/GHC/Version.hs $out/libraries/ghc-boot/GHC
162-
fi
163-
if [[ -f ${ghc.generated}/libraries/ghc-boot/dist-install/build/GHC/Platform/Host.hs ]]; then
164-
ln -s ${ghc.generated}/libraries/ghc-boot/dist-install/build/GHC/Platform/Host.hs $out/libraries/ghc-boot/GHC/Platform
165-
fi
166-
if [[ -f ${ghc.generated}/compiler/stage2/build/Config.hs ]]; then
167-
ln -s ${ghc.generated}/compiler/stage2/build/Config.hs $out/compiler
168-
fi
169-
if [[ -f ${ghc.generated}/compiler/stage2/build/GHC/Platform/Constants.hs ]]; then
170-
ln -s ${ghc.generated}/compiler/stage2/build/GHC/Platform/Constants.hs $out/compiler/GHC/Platform
171-
fi
172-
if [[ -f ${ghc.generated}/compiler/stage2/build/GHC/Settings/Config.hs ]]; then
173-
ln -s ${ghc.generated}/compiler/stage2/build/GHC/Settings/Config.hs $out/compiler/GHC/Settings
174-
fi
175-
if [[ -f ${ghc.generated}/compiler/GHC/CmmToLlvm/Version/Bounds.hs ]]; then
176-
ln -s ${ghc.generated}/compiler/GHC/CmmToLlvm/Version/Bounds.hs $out/compiler/GHC/CmmToLlvm/Version
177-
fi
178-
ln -s ${ghc.generated}/includes/dist-derivedconstants/header/* $out/compiler
179-
ln -s ${ghc.generated}/compiler/stage2/build/*.hs-incl $out/compiler
180-
'');
181-
inherit subDir;
182-
includeSiblings = true;
183-
}
184-
else "${ghc.passthru.configured-src}/${subDir}";
185-
nix = callCabal2Nix ghcName "${ghcName}-${pkgName}" src;
144+
src = null;
145+
# # TODO remove once nix >=2.4 is widely adopted (will trigger rebuilds of everything).
146+
# # See https://github.com/input-output-hk/haskell.nix/issues/1459
147+
# let nix24srcFix = src: src // { filterPath = { path, ... }: path; };
148+
# # Add in the generated files needed by ghc-boot
149+
# in if subDir == "libraries/ghc-boot"
150+
# then nix24srcFix (final.buildPackages.runCommand "ghc-boot-src" { nativeBuildInputs = [final.buildPackages.xorg.lndir]; } ''
151+
# mkdir $out
152+
# lndir -silent ${ghc.passthru.configured-src}/${subDir} $out
153+
# lndir -silent ${ghc.generated}/libraries/ghc-boot/dist-install/build/GHC $out/GHC
154+
# '')
155+
# else if subDir == "compiler"
156+
# then final.haskell-nix.haskellLib.cleanSourceWith {
157+
# src = nix24srcFix (final.buildPackages.runCommand "ghc-src" { nativeBuildInputs = [final.buildPackages.xorg.lndir]; } ''
158+
# mkdir $out
159+
# lndir -silent ${ghc.passthru.configured-src} $out
160+
# if [[ -f ${ghc.generated}/libraries/ghc-boot/dist-install/build/GHC/Version.hs ]]; then
161+
# ln -s ${ghc.generated}/libraries/ghc-boot/dist-install/build/GHC/Version.hs $out/libraries/ghc-boot/GHC
162+
# fi
163+
# if [[ -f ${ghc.generated}/libraries/ghc-boot/dist-install/build/GHC/Platform/Host.hs ]]; then
164+
# ln -s ${ghc.generated}/libraries/ghc-boot/dist-install/build/GHC/Platform/Host.hs $out/libraries/ghc-boot/GHC/Platform
165+
# fi
166+
# if [[ -f ${ghc.generated}/compiler/stage2/build/Config.hs ]]; then
167+
# ln -s ${ghc.generated}/compiler/stage2/build/Config.hs $out/compiler
168+
# fi
169+
# if [[ -f ${ghc.generated}/compiler/stage2/build/GHC/Platform/Constants.hs ]]; then
170+
# ln -s ${ghc.generated}/compiler/stage2/build/GHC/Platform/Constants.hs $out/compiler/GHC/Platform
171+
# fi
172+
# if [[ -f ${ghc.generated}/compiler/stage2/build/GHC/Settings/Config.hs ]]; then
173+
# ln -s ${ghc.generated}/compiler/stage2/build/GHC/Settings/Config.hs $out/compiler/GHC/Settings
174+
# fi
175+
# if [[ -f ${ghc.generated}/compiler/GHC/CmmToLlvm/Version/Bounds.hs ]]; then
176+
# ln -s ${ghc.generated}/compiler/GHC/CmmToLlvm/Version/Bounds.hs $out/compiler/GHC/CmmToLlvm/Version
177+
# fi
178+
# ln -s ${ghc.generated}/includes/dist-derivedconstants/header/* $out/compiler
179+
# ln -s ${ghc.generated}/compiler/stage2/build/*.hs-incl $out/compiler
180+
# '');
181+
# inherit subDir;
182+
# includeSiblings = true;
183+
# }
184+
# else "${ghc.passthru.configured-src}/${subDir}";
185+
nix = null; # callCabal2Nix ghcName "${ghcName}-${pkgName}" src;
186186
}) (ghc-extra-pkgs ghc.version))
187187
final.buildPackages.haskell-nix.compiler;
188188

@@ -195,6 +195,121 @@ in rec {
195195
(combineAndMaterialize true ../materialized)
196196
ghc-boot-packages-src-and-nix;
197197

198+
corePackagesMap = {
199+
"base" = _ : {
200+
package = {
201+
identifier = {
202+
name = "base";
203+
version = "4.19.1.0";
204+
};
205+
};
206+
};
207+
# "bytestring" = _: {
208+
# package = {
209+
# identifier = {
210+
# name = "bytestring";
211+
# version = "0.12.1.0";
212+
# };
213+
# };
214+
# };
215+
# "deepseq" = _: {
216+
# package = {
217+
# identifier = {
218+
# name = "deepseq";
219+
# version = "1.5.0.0";
220+
# };
221+
# };
222+
# };
223+
# "ghc" = _: {
224+
# package = {
225+
# identifier = {
226+
# name = "ghc";
227+
# version = "9.8.2";
228+
# };
229+
# };
230+
# };
231+
"ghc-bignum" = _: {
232+
package = {
233+
identifier = {
234+
name = "ghc-bignum";
235+
version = "1.3";
236+
};
237+
};
238+
};
239+
"ghc-boot" = _: {
240+
package = {
241+
identifier = {
242+
name = "ghc-boot";
243+
version = "9.8.2";
244+
};
245+
};
246+
};
247+
"ghc-heap" = _: {
248+
package = {
249+
identifier = {
250+
name = "ghc-heap";
251+
version = "9.8.2";
252+
};
253+
};
254+
};
255+
"ghc-prim" = _: {
256+
package = {
257+
identifier = {
258+
name = "ghc-prim";
259+
version = "9.8.2";
260+
};
261+
};
262+
};
263+
"ghci" = _: {
264+
package = {
265+
identifier = {
266+
name = "ghci";
267+
version = "9.8.2";
268+
};
269+
};
270+
};
271+
"hpc" = _: {
272+
package = {
273+
identifier = {
274+
name = "hpc";
275+
version = "0.7.0.0";
276+
};
277+
};
278+
};
279+
"integer-gmp" = _: {
280+
package = {
281+
identifier = {
282+
name = "integer-gmp";
283+
version = "1.1";
284+
};
285+
};
286+
};
287+
# "parsec" = _: {
288+
# package = {
289+
# identifier = {
290+
# name = "parsec";
291+
# version = "3.1.17.0";
292+
# };
293+
# };
294+
# };
295+
# "pretty" = _: {
296+
# package = {
297+
# identifier = {
298+
# name = "pretty";
299+
# version = "1.1.3.6";
300+
# };
301+
# };
302+
# };
303+
# "template-haskell" = _: {
304+
# package = {
305+
# identifier = {
306+
# name = "template-haskell";
307+
# version = "2.21.0.0";
308+
# };
309+
# };
310+
# };
311+
};
312+
198313
# The import nix results for each ghc boot package for each ghc.
199314
ghc-boot-packages = builtins.mapAttrs
200315
(ghcName: value: builtins.mapAttrs
@@ -205,11 +320,12 @@ in rec {
205320
ghc-boot-packages-src-and-nix;
206321

207322
ghc-boot-packages-unchecked = builtins.mapAttrs
208-
(ghcName: value: builtins.mapAttrs
209-
(pkgName: srcAndNix: importSrcAndNix {
210-
inherit (srcAndNix) src;
211-
nix = final.ghc-boot-packages-nix-unchecked.${ghcName} + "/${pkgName}.nix";
212-
}) value)
323+
(ghcName: value: {})
324+
# (ghcName: value: builtins.mapAttrs (_: _ : {}) value)
325+
# (pkgName: srcAndNix: importSrcAndNix {
326+
# inherit (srcAndNix) src;
327+
# nix = final.ghc-boot-packages-nix-unchecked.${ghcName} + "/${pkgName}.nix";
328+
# }) value)
213329
ghc-boot-packages-src-and-nix;
214330

215331
# Derivation with cabal.project for use with `cabalProject'` for each ghc.

overlays/haskell.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ final: prev: {
155155
if compiler-nix-name != null
156156
then compiler-nix-name
157157
else ((plan-pkgs.extras hackage).compiler or (plan-pkgs.pkgs hackage).compiler).nix-name;
158-
pkg-def = excludeBootPackages compiler-nix-name plan-pkgs.pkgs;
158+
# pkg-def = excludeBootPackages compiler-nix-name plan-pkgs.pkgs;
159+
pkg-def = plan-pkgs.pkgs;
159160
patchesModule = ghcHackagePatches.${compiler-nix-name'} or {};
160161
package.compiler-nix-name.version = (compilerSelection final.buildPackages).${compiler-nix-name'}.version;
161162
plan.compiler-nix-name.version = (compilerSelection final.buildPackages).${(plan-pkgs.pkgs hackage).compiler.nix-name}.version;

0 commit comments

Comments
 (0)