Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip] haskell: add core libraries logic to remove need for global package db #43300

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
39 changes: 39 additions & 0 deletions pkgs/development/compilers/ghc/8.6.1.nix
Expand Up @@ -208,6 +208,45 @@ stdenv.mkDerivation (rec {

# Our Cabal compiler name
haskellCompilerName = "ghc-8.4.3";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated issue here, btw


# Libraries included in this Haskell compiler
libraries = [
"rts"

"Cabal-2.3.0.0"
"array-0.5.2.0"
"base-4.12.0.0"
"binary-0.8.5.1"
"bytestring-0.10.8.2"
"containers-0.6.0.1"
"deepseq-1.4.4.0"
"directory-1.3.2.3"
"filepath-1.4.2"
# "ghc-8.6.0.20180627"
"ghc-boot-8.6.0.20180627"
"ghc-boot-th-8.6.0.20180627"
"ghc-compact-0.1.0.0"
"ghc-heap-8.6.0.20180627"
"ghc-prim-0.5.3"
"ghci-8.6.0.20180627"
"haskeline-0.7.4.2"
"hpc-0.6.0.3"
"integer-gmp-1.0.2.0"
"libiserv-8.6.1"
"mtl-2.2.2"
"parsec-3.1.13.0.0.0.0.0"
"pretty-1.1.3.6"
"process-1.6.3.0"
"stm-2.5.0.0"
"template-haskell-2.14.0.0"
"terminfo-0.4.1.1"
"text-1.2.3.0"
"time-1.8.0.2"
"transformers-0.5.5.0"
"unix-2.8.0.0"
"xhtml-3000.2.2"
];

};

meta = {
Expand Down
34 changes: 0 additions & 34 deletions pkgs/development/haskell-modules/configuration-ghc-8.6.x.nix
Expand Up @@ -7,40 +7,6 @@ self: super: {
# This compiler version needs llvm 5.x.
llvmPackages = pkgs.llvmPackages_5;

# Disable GHC 8.6.x core libraries.
array = null;
base = null;
binary = null;
bytestring = null;
Cabal = null;
containers = null;
deepseq = null;
directory = null;
filepath = null;
ghc-boot = null;
ghc-boot-th = null;
ghc-compact = null;
ghc-heap = null;
ghc-prim = null;
ghci = null;
haskeline = null;
hpc = null;
integer-gmp = null;
libiserv = null;
mtl = null;
parsec = null;
pretty = null;
process = null;
rts = null;
stm = null;
template-haskell = null;
terminfo = null;
text = null;
time = null;
transformers = null;
unix = null;
xhtml = null;

# Use to be a core-library, but no longer is since GHC 8.4.x.
hoopl = self.hoopl_3_10_2_2;

Expand Down
29 changes: 27 additions & 2 deletions pkgs/development/haskell-modules/default.nix
Expand Up @@ -18,15 +18,40 @@ let
inherit stdenv haskellLib ghc buildHaskellPackages extensible-self all-cabal-hashes;
};

# Create core library set. Each library listed in the GHC compiler’s
# libraries passthru is mapped to a scrapped package.
coreLibraries = self: super: let
# Make a derivation that is just a copy of one of GHC’s core
# libraries. This is done to prevent stuff built by GHC from
# referencing GHC itself.
mkCoreLib = ghc: pkg: rec {
inherit (builtins.parseDrvName pkg) name;
value = pkgs.runCommand pkg (lib.optionalAttrs (name == "base") {
propagatedBuildInputs = [ self.rts ];
}) ''
install -D ${ghc}/lib/${ghc.name}/package.conf.d/${pkg}.conf \
$out/lib/${ghc.name}/package.conf.d/${pkg}.conf
cp -r ${ghc}/lib/${ghc.name}/${pkg} $out/lib/${ghc.name}
${lib.optionalString (name == "rts")
"cp -r ${ghc}/lib/${ghc.name}/include $out/lib/${ghc.name}"}
for conf in $out/lib/${ghc.name}/package.conf.d/*.conf; do
substituteInPlace $conf --replace ${ghc} $out
done

eval fixupPhase
'';
}; in builtins.listToAttrs (map (mkCoreLib ghc) (super.ghc.libraries or []));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation?


commonConfiguration = configurationCommon { inherit pkgs haskellLib; };
nixConfiguration = configurationNix { inherit pkgs haskellLib; };

extensible-self = makeExtensible
(extends overrides
(extends packageSetConfig
(extends compilerConfig
(extends commonConfiguration
(extends nixConfiguration haskellPackages)))));
(extends coreLibraries
(extends commonConfiguration
(extends nixConfiguration haskellPackages))))));

in

Expand Down
2 changes: 2 additions & 0 deletions pkgs/development/haskell-modules/generic-builder.nix
Expand Up @@ -163,6 +163,8 @@ let
] ++ optionals dontStrip [
"--disable-library-stripping"
"--disable-executable-stripping"
] ++ optionals (ghc ? libraries) [
"--ghc-option=-no-global-package-db"
] ++ optionals isGhcjs [
"--ghcjs"
] ++ optionals isCross ([
Expand Down