Skip to content

Commit 879ced1

Browse files
committed
wip
1 parent c435c91 commit 879ced1

File tree

8 files changed

+704
-32
lines changed

8 files changed

+704
-32
lines changed

builder/default.nix

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ let
6262
# Use hoogle.nix from at least nixpkgs 22.05
6363
nixpkgs = if lib.versionAtLeast lib.trivial.release "22.05"
6464
then pkgs.path
65-
else pkgs.haskell-nix.sources.nixpkgs-2205;
65+
else pkgs.haskell-nix.sources.nixpkgs-2405;
6666
nixpkgsHoogle = import (nixpkgs + /pkgs/development/haskell-modules/hoogle.nix);
67-
in { packages ? [], hoogle ? pkgs.buildPackages.haskell-nix.tool "ghc928" "hoogle" {
67+
in { packages ? [], hoogle ? pkgs.buildPackages.haskell-nix.tool "ghc982" "hoogle" {
6868
inherit evalPackages;
69-
version = "5.0.18.3";
69+
version = "5.0.18.4";
7070
# index-state = pkgs.haskell-nix.internalHackageIndexState;
71-
index-state = "2023-06-05T00:00:00Z";
71+
index-state = "2024-05-15T00:00:00Z";
7272
}
7373
}:
7474
let

compiler/ghc-configure-src/default.nix

Lines changed: 598 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{ src, stdenv, pkgs, version, ghc, alex, happy, hscolour }:
2+
stdenv.mkDerivation {
3+
4+
inherit version;
5+
6+
name = "ghc-source-dist";
7+
8+
buildInputs = [ ghc alex happy hscolour ] ++ (with pkgs; [ automake bash git cacert python3 autoconf xorg.lndir ]);
9+
10+
inherit src;
11+
12+
phases = [ "unpackPhase" "buildPhase" "installPhase" ];
13+
14+
buildPhase = ''
15+
# Happy and Alex are confused about their data dirs. See
16+
# https://github.com/haskell/cabal/issues/5862 for details.
17+
#
18+
# This is fixed in more recent builds. We can't rely on
19+
# custom built tools as computing the source-dist is pretty
20+
# much in the bootstrap lane.
21+
22+
export alex_datadir=$(find ${alex}/share -name "alex-*" -type d -and -not -path "*doc*")
23+
export happy_datadir=$(find ${happy}/share -name "happy-*" -type d -and -not -path "*doc*")
24+
25+
# We need to --skip-url-rewrites, ghc is a bit too strict here.
26+
python3 ./boot --skip-url-rewrites
27+
# let's not flood the screen with garbage.
28+
./configure --silent
29+
30+
# this folder ends up being needed for the windows dists; just mock it.
31+
mkdir ghc-tarballs
32+
make sdist --silent
33+
'';
34+
35+
installPhase = ''
36+
mkdir -p $out
37+
install -Dm644 sdistprep/ghc-$(cat VERSION)-src.tar.xz $out/src.tar.xz
38+
install -Dm644 sdistprep/ghc-$(cat VERSION)-testsuite.tar.xz $out/testsuite.tar.xz
39+
'';
40+
}

nix-tools/cabal.project

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ allow-newer:
2424
hnix-store-core:cryptonite,
2525
hnix-store-core:bytestring
2626

27-
source-repository-package
28-
type: git
29-
location: https://github.com/michaelpj/hackage-db.git
30-
tag: 83f819cb08742d3c86a83b407d45c1f6c1c7e299
27+
-- source-repository-package
28+
-- type: git
29+
-- location: https://github.com/michaelpj/hackage-db.git
30+
-- tag: 83f819cb08742d3c86a83b407d45c1f6c1c7e299
3131
--sha256: sha256-8NTfSb1fE/so843qG59XpvPE2HIYTa0D1UrpnHdJ44U=

nix-tools/t

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{ system
2+
, compiler
3+
, flags
4+
, pkgs
5+
, hsPkgs
6+
, pkgconfPkgs
7+
, errorHandler
8+
, config
9+
, ... }:
10+
{
11+
flags = {};
12+
package = {
13+
specVersion = "3.0";
14+
identifier = { name = "ghc-boot"; version = "9.3"; };
15+
license = "BSD-3-Clause";
16+
copyright = "";
17+
maintainer = "[email protected]";
18+
author = "";
19+
homepage = "";
20+
url = "";
21+
synopsis = "Shared functionality between GHC and its boot libraries";
22+
description = "This library is shared between GHC, ghc-pkg, and other boot\nlibraries.\n.\nA note about \"GHC.Unit.Database\": it only deals with the subset of\nthe package database that the compiler cares about: modules\npaths etc and not package metadata like description, authors\netc. It is thus not a library interface to ghc-pkg and is *not*\nsuitable for modifying GHC package databases.\n.\nThe package database format and this library are constructed in\nsuch a way that while ghc-pkg depends on Cabal, the GHC library\nand program do not have to depend on Cabal.";
23+
buildType = "Simple";
24+
};
25+
components = {
26+
"library" = {
27+
depends = [
28+
(hsPkgs."base" or (errorHandler.buildDepError "base"))
29+
(hsPkgs."binary" or (errorHandler.buildDepError "binary"))
30+
(hsPkgs."bytestring" or (errorHandler.buildDepError "bytestring"))
31+
(hsPkgs."containers" or (errorHandler.buildDepError "containers"))
32+
(hsPkgs."directory" or (errorHandler.buildDepError "directory"))
33+
(hsPkgs."filepath" or (errorHandler.buildDepError "filepath"))
34+
(hsPkgs."deepseq" or (errorHandler.buildDepError "deepseq"))
35+
(hsPkgs."ghc-boot-th" or (errorHandler.buildDepError "ghc-boot-th"))
36+
];
37+
buildable = true;
38+
};
39+
};
40+
} // rec { src = (pkgs.lib).mkDefault ./.; }

overlays/bootstrap.nix

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,10 @@ 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; /* final.callPackage ../compiler/ghc (traceWarnOld "9.8" {
30-
extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc982; };
31-
32-
bootPkgs = bootPkgsGhc94 // {
33-
ghc = if final.stdenv.buildPlatform != final.stdenv.targetPlatform
34-
then final.buildPackages.buildPackages.haskell-nix.compiler.ghc964
35-
else final.buildPackages.buildPackages.haskell.compiler.ghc964
36-
or final.buildPackages.buildPackages.haskell.compiler.ghc963
37-
or final.buildPackages.buildPackages.haskell.compiler.ghc962
38-
or final.buildPackages.buildPackages.haskell.compiler.ghc945
39-
or final.buildPackages.buildPackages.haskell.compiler.ghc944
40-
or final.buildPackages.buildPackages.haskell.compiler.ghc943;
41-
};
42-
inherit sphinx;
43-
29+
ghc982 = final.haskell.compiler.ghc982.overrideAttrs (prevAttrs: rec {
30+
passthru = prevAttrs.passthru // {
31+
configured-src =
32+
(final.callPackage ../compiler/ghc-configure-src ({
4433
buildLlvmPackages = final.buildPackages.llvmPackages_12;
4534
llvmPackages = final.llvmPackages_12;
4635

@@ -49,10 +38,9 @@ in {
4938
url = "https://downloads.haskell.org/~ghc/${version}/ghc-${version}-src.tar.xz";
5039
sha256 = "sha256-4vt6fddGEjfSLoNlqD7dnhp30uFdBF85RTloRah3gck=";
5140
};
52-
53-
ghc-patches = ghc-patches "9.8.2";
54-
});
55-
*/
41+
})).passthru.configured-src;
42+
};
43+
});
5644
};
5745

5846
# Both `cabal-install` and `nix-tools` are needed for `cabalProject`

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/haskell.nix

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,16 @@ final: prev: {
9595
"ghc-bignum" "ghc-boot" "ghc-heap" "ghc-prim" "ghci" "hpc"
9696
"integer-gmp" "iserv" "parsec" "pretty" "remote-iserv" "template-haskell"
9797
];
98-
in original // {
99-
packages = final.lib.filterAttrs (n: _: final.lib.all (b: n != b) bootPkgNames)
100-
original.packages;
98+
in
99+
original // {
100+
packages = original.packages // final.lib.mapAttrs (key: value : { revision = value; }) (builtins.intersectAttrs original.packages final.ghc-boot-packages-unchecked.${compiler-nix-name});
101101
};
102+
# if builtins.hasAttr "ghc" original.packages then
103+
# original // {
104+
# packages = final.lib.filterAttrs (n: _: final.lib.all (b: n != b) bootPkgNames)
105+
# original.packages;
106+
# }
107+
# else original;
102108

103109
# Create a Haskell package set based on a Stack configuration.
104110
mkStackPkgSet =
@@ -149,7 +155,7 @@ final: prev: {
149155
if compiler-nix-name != null
150156
then compiler-nix-name
151157
else ((plan-pkgs.extras hackage).compiler or (plan-pkgs.pkgs hackage).compiler).nix-name;
152-
pkg-def = plan-pkgs.pkgs;
158+
pkg-def = excludeBootPackages compiler-nix-name plan-pkgs.pkgs;
153159
patchesModule = ghcHackagePatches.${compiler-nix-name'} or {};
154160
package.compiler-nix-name.version = (compilerSelection final.buildPackages).${compiler-nix-name'}.version;
155161
plan.compiler-nix-name.version = (compilerSelection final.buildPackages).${(plan-pkgs.pkgs hackage).compiler.nix-name}.version;

0 commit comments

Comments
 (0)