Allows haskell.nix to be used as a nix flake.

Authored-by: Alexander Bantyev <balsoft@balsoft.ru>
This commit is contained in:
Hamish Mackenzie 2020-05-07 11:16:38 +12:00 committed by GitHub
parent da0473aec3
commit a2d97bd9ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 322 additions and 271 deletions

View File

@ -4,8 +4,9 @@ let haskellNix = rec {
};
config = import ./config.nix;
overlays = import ./overlays;
nixpkgsArgs = { inherit overlays config; };
overlays = [ allOverlays.combined ];
allOverlays = import ./overlays;
nixpkgsArgs = { inherit config overlays; };
};
haskellNixV1 = haskellNix.nixpkgsArgs;

25
flake.nix Normal file
View File

@ -0,0 +1,25 @@
{
description = "Alternative Haskell Infrastructure for Nixpkgs";
edition = 201909;
outputs = { self }: {
overlay = self.overlays.combined;
overlays = import ./overlays;
config = import ./config.nix;
sources = import ./nixpkgs;
nixpkgsArgs = {
inherit (self) config;
overlays = [ self.overlay ];
};
legacyPackages = let
genAttrs = lst: f:
builtins.listToAttrs (map (name: {
inherit name;
value = f name;
}) lst);
in genAttrs [ "x86_64-linux" "x86_64-darwin" ] (system:
import self.sources.nixpkgs-default
(self.nixpkgsArgs // { localSystem = { inherit system; }; }));
};
}

View File

@ -69,7 +69,6 @@ concatMap (dep:
}
else builtins.fetchGit {
inherit (dep) url rev;
ref = "*";
};
in map (subdir: {
name = cabalName "${pkgsrc}/${subdir}";

View File

@ -1,7 +1,7 @@
self: super:
final: prev:
{
haskell-nix = super.haskell-nix // ({
defaultModules = super.haskell-nix.defaultModules ++ [
haskell-nix = prev.haskell-nix // ({
defaultModules = prev.haskell-nix.defaultModules ++ [
({ pkgs, buildModules, config, lib, ... }:
let
withTH = import ./linux-cross.nix {
@ -15,10 +15,10 @@ self: super:
inherit (pkgs) gmp;
# iserv-proxy needs to come from the buildPackages, as it needs to run on the
# build host.
inherit (self.buildPackages.ghc-extra-packages."${config.compiler.nix-name}".iserv-proxy.components.exes) iserv-proxy;
inherit (final.buildPackages.ghc-extra-packages."${config.compiler.nix-name}".iserv-proxy.components.exes) iserv-proxy;
# remote-iserv however needs to come from the regular packages as it has to
# run on the target host.
inherit (self.ghc-extra-packages."${config.compiler.nix-name}".remote-iserv.components.exes) remote-iserv;
inherit (final.ghc-extra-packages."${config.compiler.nix-name}".remote-iserv.components.exes) remote-iserv;
# we need to use openssl.bin here, because the .dll's are in the .bin expression.
extra-test-libs = [
# pkgs.rocksdb

View File

@ -1,4 +1,4 @@
self: super:
final: prev:
let
installDeps = targetPrefix: ''
for P in $($out/bin/${targetPrefix}ghc-pkg list --simple-output | sed 's/-[0-9][0-9.]*//g'); do
@ -29,26 +29,26 @@ let
done
'';
in {
haskell-nix = super.haskell-nix // {
haskell-nix = prev.haskell-nix // {
# Use this to disable the existing haskell infra structure for testing purposes
compiler =
let bootPkgs = with self.buildPackages; {
let bootPkgs = with final.buildPackages; {
ghc = buildPackages.haskell-nix.bootstrap.compiler.ghc844;
inherit (self.haskell-nix.bootstrap.packages) alex happy hscolour;
inherit (final.haskell-nix.bootstrap.packages) alex happy hscolour;
};
sphinx = with self.buildPackages; (python3Packages.sphinx_1_7_9 or python3Packages.sphinx);
hsc2hs-align-conditionals-patch = self.fetchpatch {
sphinx = with final.buildPackages; (python3Packages.sphinx_1_7_9 or python3Packages.sphinx);
hsc2hs-align-conditionals-patch = final.fetchpatch {
url = "https://git.haskell.org/hsc2hs.git/patch/738f3666c878ee9e79c3d5e819ef8b3460288edf";
sha256 = "0plzsbfaq6vb1023lsarrjglwgr9chld4q3m99rcfzx0yx5mibp3";
extraPrefix = "utils/hsc2hs/";
stripLen = 1;
};
D5123-patch = self.fetchpatch rec { # https://phabricator.haskell.org/D5123
D5123-patch = final.fetchpatch rec { # https://phabricator.haskell.org/D5123
url = "http://tarballs.nixos.org/sha256/${sha256}";
name = "D5123.diff";
sha256 = "0nhqwdamf2y4gbwqxcgjxs0kqx23w9gv5kj0zv6450dq19rji82n";
};
haddock-900-patch = self.fetchpatch rec { # https://github.com/haskell/haddock/issues/900
haddock-900-patch = final.fetchpatch rec { # https://github.com/haskell/haddock/issues/900
url = "https://patch-diff.githubusercontent.com/raw/haskell/haddock/pull/983.diff";
name = "loadpluginsinmodules.diff";
sha256 = "0bvvv0zsfq2581zsir97zfkggc1kkircbbajc2fz3b169ycpbha1";
@ -60,10 +60,10 @@ in {
versionLessThan = ver: builtins.compareVersions ver version == 1;
# Returns true iff this derivation's verion is greater than or equal to ver.
versionAtLeast = ver: !versionLessThan ver;
from = start: self.lib.optional (versionAtLeast start);
fromUntil = start: end: self.lib.optional (versionAtLeast start && versionLessThan end);
until = end: self.lib.optional (versionLessThan end);
always = self.lib.optional true;
from = start: final.lib.optional (versionAtLeast start);
fromUntil = start: end: final.lib.optional (versionAtLeast start && versionLessThan end);
until = end: final.lib.optional (versionLessThan end);
always = final.lib.optional true;
# Try to avoid reordering the patches unless a patch is added or changed that
# will be applied to most versions of the GHC anyway (reordering the patches
# results in rebuilds of GHC and reduces sharing in /nix/store).
@ -101,25 +101,25 @@ in {
++ fromUntil "8.6.4" "8.8" ./patches/ghc/global-offset-table.patch
++ fromUntil "8.6.4" "8.8" ./patches/ghc/global-offset-table-2.patch
++ self.lib.optional (version == "8.6.3") ./patches/ghc/T16057--ghci-doa-on-windows.patch
++ self.lib.optional (version == "8.6.3") ./patches/ghc/ghc-8.6.3-reinstallable-lib-ghc.patch
++ self.lib.optional (version == "8.6.4") ./patches/ghc/ghc-8.6.4-reinstallable-lib-ghc.patch
++ self.lib.optional (version == "8.6.5") ./patches/ghc/ghc-8.6.5-reinstallable-lib-ghc.patch
++ self.lib.optional (version == "8.6.5") ./patches/ghc/ghc-8.6.5-atomic-arm-arch.patch
++ self.lib.optional (version == "8.8.1") ./patches/ghc/ghc-8.8.1-reinstallable-lib-ghc.patch
++ final.lib.optional (version == "8.6.3") ./patches/ghc/T16057--ghci-doa-on-windows.patch
++ final.lib.optional (version == "8.6.3") ./patches/ghc/ghc-8.6.3-reinstallable-lib-ghc.patch
++ final.lib.optional (version == "8.6.4") ./patches/ghc/ghc-8.6.4-reinstallable-lib-ghc.patch
++ final.lib.optional (version == "8.6.5") ./patches/ghc/ghc-8.6.5-reinstallable-lib-ghc.patch
++ final.lib.optional (version == "8.6.5") ./patches/ghc/ghc-8.6.5-atomic-arm-arch.patch
++ final.lib.optional (version == "8.8.1") ./patches/ghc/ghc-8.8.1-reinstallable-lib-ghc.patch
++ fromUntil "8.8.2" "8.9" ./patches/ghc/ghc-8.8.2-reinstallable-lib-ghc.patch
++ self.lib.optional (version == "8.6.4") ./patches/ghc/ghc-8.6.4-better-plusSimplCountErrors.patch
++ self.lib.optional (versionAtLeast "8.6.4" && self.stdenv.isDarwin) ./patches/ghc/ghc-macOS-loadArchive-fix.patch
++ self.lib.optional (versionAtLeast "8.4.4" && self.stdenv.isDarwin) ./patches/ghc/ghc-darwin-gcc-version-fix.patch
++ final.lib.optional (version == "8.6.4") ./patches/ghc/ghc-8.6.4-better-plusSimplCountErrors.patch
++ final.lib.optional (versionAtLeast "8.6.4" && final.stdenv.isDarwin) ./patches/ghc/ghc-macOS-loadArchive-fix.patch
++ final.lib.optional (versionAtLeast "8.4.4" && final.stdenv.isDarwin) ./patches/ghc/ghc-darwin-gcc-version-fix.patch
;
in ({
ghc844 = self.callPackage ../compiler/ghc {
extra-passthru = { buildGHC = self.buildPackages.haskell-nix.compiler.ghc844; };
ghc844 = final.callPackage ../compiler/ghc {
extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc844; };
inherit bootPkgs sphinx installDeps;
buildLlvmPackages = self.buildPackages.llvmPackages_5;
llvmPackages = self.llvmPackages_5;
buildLlvmPackages = final.buildPackages.llvmPackages_5;
llvmPackages = final.llvmPackages_5;
src-spec = rec {
version = "8.4.4";
@ -129,15 +129,15 @@ in {
ghc-patches = ghc-patches "8.4.4"
++ [ hsc2hs-align-conditionals-patch D5123-patch ]
++ self.lib.optional self.stdenv.isDarwin ./patches/ghc/ghc-8.4.4-backport-dylib-command-size-limit.patch;
++ final.lib.optional final.stdenv.isDarwin ./patches/ghc/ghc-8.4.4-backport-dylib-command-size-limit.patch;
};
ghc861 = self.callPackage ../compiler/ghc {
extra-passthru = { buildGHC = self.buildPackages.haskell-nix.compiler.ghc861; };
ghc861 = final.callPackage ../compiler/ghc {
extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc861; };
inherit bootPkgs sphinx installDeps;
buildLlvmPackages = self.buildPackages.llvmPackages_6;
llvmPackages = self.llvmPackages_6;
buildLlvmPackages = final.buildPackages.llvmPackages_6;
llvmPackages = final.llvmPackages_6;
src-spec = rec {
version = "8.6.1";
@ -147,13 +147,13 @@ in {
ghc-patches = [ D5123-patch ];
};
ghc862 = self.callPackage ../compiler/ghc {
extra-passthru = { buildGHC = self.buildPackages.haskell-nix.compiler.ghc862; };
ghc862 = final.callPackage ../compiler/ghc {
extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc862; };
inherit bootPkgs sphinx installDeps;
buildLlvmPackages = self.buildPackages.llvmPackages_6;
llvmPackages = self.llvmPackages_6;
buildLlvmPackages = final.buildPackages.llvmPackages_6;
llvmPackages = final.llvmPackages_6;
src-spec = rec {
version = "8.6.2";
@ -164,13 +164,13 @@ in {
ghc-patches = ghc-patches "8.6.2"
++ [ D5123-patch ];
};
ghc863 = self.callPackage ../compiler/ghc {
extra-passthru = { buildGHC = self.buildPackages.haskell-nix.compiler.ghc863; };
ghc863 = final.callPackage ../compiler/ghc {
extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc863; };
inherit bootPkgs sphinx installDeps;
buildLlvmPackages = self.buildPackages.llvmPackages_6;
llvmPackages = self.llvmPackages_6;
buildLlvmPackages = final.buildPackages.llvmPackages_6;
llvmPackages = final.llvmPackages_6;
src-spec = rec {
version = "8.6.3";
@ -181,13 +181,13 @@ in {
ghc-patches = ghc-patches "8.6.3"
++ [ D5123-patch ];
};
ghc864 = self.callPackage ../compiler/ghc {
extra-passthru = { buildGHC = self.buildPackages.haskell-nix.compiler.ghc864; };
ghc864 = final.callPackage ../compiler/ghc {
extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc864; };
inherit bootPkgs sphinx installDeps;
buildLlvmPackages = self.buildPackages.llvmPackages_6;
llvmPackages = self.llvmPackages_6;
buildLlvmPackages = final.buildPackages.llvmPackages_6;
llvmPackages = final.llvmPackages_6;
src-spec = rec {
version = "8.6.4";
@ -198,13 +198,13 @@ in {
ghc-patches = ghc-patches "8.6.4"
++ [ D5123-patch ];
};
ghc865 = self.callPackage ../compiler/ghc {
extra-passthru = { buildGHC = self.buildPackages.haskell-nix.compiler.ghc865; };
ghc865 = final.callPackage ../compiler/ghc {
extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc865; };
inherit bootPkgs sphinx installDeps;
buildLlvmPackages = self.buildPackages.llvmPackages_6;
llvmPackages = self.llvmPackages_6;
buildLlvmPackages = final.buildPackages.llvmPackages_6;
llvmPackages = final.llvmPackages_6;
src-spec = rec {
version = "8.6.5";
@ -215,13 +215,13 @@ in {
ghc-patches = ghc-patches "8.6.5"
++ [ D5123-patch haddock-900-patch ];
};
ghc881 = self.callPackage ../compiler/ghc {
extra-passthru = { buildGHC = self.buildPackages.haskell-nix.compiler.ghc881; };
ghc881 = final.callPackage ../compiler/ghc {
extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc881; };
inherit bootPkgs sphinx installDeps;
buildLlvmPackages = self.buildPackages.llvmPackages_7;
llvmPackages = self.llvmPackages_7;
buildLlvmPackages = final.buildPackages.llvmPackages_7;
llvmPackages = final.llvmPackages_7;
src-spec = rec {
version = "8.8.1";
@ -231,13 +231,13 @@ in {
ghc-patches = ghc-patches "8.8.1";
};
ghc882 = self.callPackage ../compiler/ghc {
extra-passthru = { buildGHC = self.buildPackages.haskell-nix.compiler.ghc882; };
ghc882 = final.callPackage ../compiler/ghc {
extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc882; };
inherit bootPkgs sphinx installDeps;
buildLlvmPackages = self.buildPackages.llvmPackages_7;
llvmPackages = self.llvmPackages_7;
buildLlvmPackages = final.buildPackages.llvmPackages_7;
llvmPackages = final.llvmPackages_7;
src-spec = rec {
version = "8.8.2";
@ -247,13 +247,13 @@ in {
ghc-patches = ghc-patches "8.8.2";
};
ghc883 = self.callPackage ../compiler/ghc {
extra-passthru = { buildGHC = self.buildPackages.haskell-nix.compiler.ghc883; };
ghc883 = final.callPackage ../compiler/ghc {
extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc883; };
inherit bootPkgs sphinx installDeps;
buildLlvmPackages = self.buildPackages.llvmPackages_7;
llvmPackages = self.llvmPackages_7;
buildLlvmPackages = final.buildPackages.llvmPackages_7;
llvmPackages = final.llvmPackages_7;
src-spec = rec {
version = "8.8.3";
@ -263,7 +263,7 @@ in {
ghc-patches = ghc-patches "8.8.3";
};
} // self.lib.optionalAttrs (self.targetPlatform.isGhcjs or false)
} // final.lib.optionalAttrs (final.targetPlatform.isGhcjs or false)
# This will inject `exactDeps` and `envDeps` into the ghcjs
# compiler defined below. This is crucial to build packages
# with the current use of env and exact Deps.
@ -272,16 +272,16 @@ in {
isHaskellNixBootCompiler = true;
})
({
ghc865 = let buildGHC = self.buildPackages.haskell-nix.compiler.ghc865;
in let ghcjs865 = self.callPackage ../compiler/ghcjs/ghcjs.nix {
ghc865 = let buildGHC = final.buildPackages.haskell-nix.compiler.ghc865;
in let ghcjs865 = final.callPackage ../compiler/ghcjs/ghcjs.nix {
ghcjsSrcJson = ../compiler/ghcjs/ghcjs-src.json;
ghcjsVersion = "8.6.0.1";
ghc = buildGHC;
cabal-install = self.buildPackages.haskell-nix.cabal-install;
cabal-install = final.buildPackages.haskell-nix.cabal-install;
# The alex from the bootstrap packages is apparently broken, and will fail with something like:
# > alex: /nix/store/f7b78rg9pmqgvxvsqfzh1przp7pxii5a-alex-3.2.4-exe-alex/share/x86_64-osx-ghc-8.4.4/alex-3.2.4-1pf5faR9dBuJ8mryql0DoA-alex/AlexTemplate-ghc-nopred: openFile: does not exist (No such file or directory)
# inherit (self.buildPackages.haskell-nix.bootstrap.packages) alex happy;
}; in let targetPrefix = "js-unknown-ghcjs-"; in self.runCommand "${targetPrefix}ghc-8.6.5" {
# inherit (final.buildPackages.haskell-nix.bootstrap.packages) alex happy;
}; in let targetPrefix = "js-unknown-ghcjs-"; in final.runCommand "${targetPrefix}ghc-8.6.5" {
passthru = {
inherit targetPrefix;
version = "8.6.5";
@ -293,7 +293,7 @@ in {
"--with-ghcjs=${targetPrefix}ghc" "--with-ghcjs-pkg=${targetPrefix}ghc-pkg"
# setting gcc is stupid. non-emscripten ghcjs has no cc.
# however cabal insists on compiling the c sources. m(
"--with-gcc=${self.buildPackages.stdenv.cc}/bin/cc"
"--with-gcc=${final.buildPackages.stdenv.cc}/bin/cc"
];
};
# note: we'll use the buildGHCs `hsc2hs`, ghcjss wrapper just horribly breaks in this nix setup.
@ -310,8 +310,8 @@ in {
'' + installDeps targetPrefix);
})));
ghc = self.haskell-nix.compiler.ghc865;
inherit (self.buildPackages.haskell-nix.bootstrap.packages) cabal-install alex happy;
ghc = final.haskell-nix.compiler.ghc865;
inherit (final.buildPackages.haskell-nix.bootstrap.packages) cabal-install alex happy;
# WARN: The `import ../. {}` will prevent
# any cross to work, as we will loose
@ -320,7 +320,7 @@ in {
# haskellPackages = with import ../. {}; {
# hpack = null;
# hello = (hackage-package {
# inherit (self) cabal-install;
# inherit (final) cabal-install;
# name = "hello"; version = "1.0.0.2";
# }).components.exes.hello;
# };
@ -339,7 +339,7 @@ in {
# the bootstrap infra structure (pre-compiled ghc; bootstrapped cabal-install, ...)
bootstrap = with self.haskell-nix; let ghc = self.buildPackages.haskell-nix.bootstrap.compiler.ghc844; in {
bootstrap = with final.haskell-nix; let ghc = final.buildPackages.haskell-nix.bootstrap.compiler.ghc844; in {
# XXX: import ../. will throw away all other overlays, config values, ...
# this is not ideal!
# get binary compilers for bootstrapping. We'll put the eventual proper
@ -353,14 +353,14 @@ in {
isHaskellNixBootCompiler = true;
}
)
(import ../compiler/old-ghc-nix { pkgs = self; });
(import ../compiler/old-ghc-nix { pkgs = final; });
packages = {
# cabal has it's own bootstrap script which we'll use.
cabal-install = import ../compiler/bootstrap/cabal-install.nix {
inherit (self) fetchurl stdenv zlib;
inherit (final) fetchurl stdenv zlib;
inherit hackage ghc;
src = self.fetchurl {
src = final.fetchurl {
url = "https://github.com/haskell/cabal/archive/Cabal-v3.0.0.0-rc3.tar.gz";
sha256 = "1zl2mgg8307ykq3v8nmafc6zdhhj1cw7w8ffpap16dsm65lbnx33";
};
@ -385,7 +385,7 @@ in {
ghc = ghc // { isHaskellNixCompiler = ghc.isHaskellNixBootCompiler; };
inherit (bootstrap.packages) cabal-install nix-tools hpack;
name = "alex"; version = "3.2.4";
index-state = self.haskell-nix.internalHackageIndexState;
index-state = final.haskell-nix.internalHackageIndexState;
materialized = ../materialized/alex;
};
alex = bootstrap.packages.alex-project.hsPkgs.alex.components.exes.alex;
@ -394,7 +394,7 @@ in {
ghc = ghc // { isHaskellNixCompiler = ghc.isHaskellNixBootCompiler; };
inherit (bootstrap.packages) cabal-install nix-tools hpack;
name = "happy"; version = "1.19.11";
index-state = self.haskell-nix.internalHackageIndexState;
index-state = final.haskell-nix.internalHackageIndexState;
materialized = ../materialized/happy;
};
happy = bootstrap.packages.happy-project.hsPkgs.happy.components.exes.happy;
@ -403,7 +403,7 @@ in {
ghc = ghc // { isHaskellNixCompiler = ghc.isHaskellNixBootCompiler; };
inherit (bootstrap.packages) cabal-install nix-tools hpack;
name = "hscolour"; version = "1.24.4";
index-state = self.haskell-nix.internalHackageIndexState;
index-state = final.haskell-nix.internalHackageIndexState;
materialized = ../materialized/hscolour;
};
hscolour = bootstrap.packages.hscolour-project.hsPkgs.hscolour.components.exes.HsColour;

View File

@ -1,3 +1,3 @@
self: super: {
final: prev: {
}

View File

@ -1,19 +1,45 @@
[
let
overlays = {
wine = import ./wine.nix;
#ghcjs = import ./ghcjs-asterius-triple.nix;
#python = import ./python.nix;
haskell = import ./haskell.nix;
hackage-quirks = import ./hackage-quirks.nix;
bootstrap = import ./bootstrap.nix;
ghc = import ./ghc.nix;
ghc-packages = import ./ghc-packages.nix;
windows = import ./windows.nix;
armv6l-linux = import ./armv6l-linux.nix;
musl = import ./musl.nix;
tools = import ./tools.nix;
};
composeExtensions = f: g: final: prev:
let
fApplied = f final prev;
prev' = prev // fApplied;
in fApplied // g final prev';
ordered = with overlays; [
# Hide nixpkgs haskell and haskellPackages from the haskell-nix overlays.
# This should prevent us inadvertantly depending on them.
(_: super: { haskell = {}; haskellPackages = {}; haskell-nix-super = super; })
(import ./wine.nix)
#(import ./ghcjs-asterius-triple.nix)
#(import ./python.nix)
(import ./haskell.nix)
(import ./hackage-quirks.nix)
(import ./bootstrap.nix)
(import ./ghc.nix)
(import ./ghc-packages.nix)
(import ./windows.nix)
(import ./armv6l-linux.nix)
(import ./musl.nix)
(import ./tools.nix)
(_: prev: {
haskell = { };
haskellPackages = { };
haskell-nix-prev = prev;
})
wine
haskell
hackage-quirks
bootstrap
ghc
ghc-packages
windows
armv6l-linux
musl
tools
# Restore nixpkgs haskell and haskellPackages
(_: super: { inherit (super.haskell-nix-super) haskell haskellPackages; })
]
(_: prev: { inherit (prev.haskell-nix-prev) haskell haskellPackages; })
];
combined = builtins.foldl' composeExtensions (_: _: { }) ordered;
in overlays // { inherit combined; }

View File

@ -1,12 +1,12 @@
self: super:
final: prev:
let
emptyDotCabal = self.runCommand "empty-dot-cabal" {} ''
emptyDotCabal = final.runCommand "empty-dot-cabal" {} ''
mkdir -p $out/.cabal
cat <<EOF > $out/.cabal/config
EOF
'';
callCabalSdist = name: src: self.runCommand "${name}-sdist.tar.gz" {
nativeBuildInputs = [ self.haskell-nix.cabal-install ];
callCabalSdist = name: src: final.runCommand "${name}-sdist.tar.gz" {
nativeBuildInputs = [ final.haskell-nix.cabal-install ];
} ''
tmp=$(mktemp -d)
cp -r ${src}/* $tmp
@ -15,13 +15,13 @@ let
HOME=${emptyDotCabal} cabal new-sdist -o $tmp2
cp $tmp2/*.tar.gz $out
'';
callCabal2Nix = name: src: self.stdenv.mkDerivation {
callCabal2Nix = name: src: final.stdenv.mkDerivation {
name = "${name}-package.nix";
inherit src;
nativeBuildInputs = [ self.haskell-nix.nix-tools ];
nativeBuildInputs = [ final.haskell-nix.nix-tools ];
phases = [ "unpackPhase" "buildPhase" ];
LOCALE_ARCHIVE = self.lib.optionalString (self.stdenv.hostPlatform.libc == "glibc") "${self.glibcLocales}/lib/locale/locale-archive";
LOCALE_ARCHIVE = final.lib.optionalString (final.stdenv.hostPlatform.libc == "glibc") "${final.glibcLocales}/lib/locale/locale-archive";
LANG = "en_US.UTF-8";
LC_ALL = "en_US.UTF-8";
@ -32,8 +32,8 @@ let
# Combines multiple derivations into one to make them
# easier to materialize.
combineFiles = name: ext: files: self.linkFarm name
(self.lib.mapAttrsToList (name: path: {
combineFiles = name: ext: files: final.linkFarm name
(final.lib.mapAttrsToList (name: path: {
name = name + ext;
inherit path;
}) files);
@ -57,10 +57,10 @@ let
# processed yet by `nix-tools`, so we are not materializing the
# ones that currently fail.
# (we need to upgrade `nix-tools` to Cabal 3 for them to work)
skipBroken = self.lib.filterAttrs (pkgName: _:
skipBroken = final.lib.filterAttrs (pkgName: _:
ghcName == "ghc865" || (pkgName != "base" && pkgName != "ghc-heap"));
materializedPath = ../materialized/ghc-boot-packages-nix + "/${ghcName}";
in (self.haskell-nix.materialize ({
in (final.haskell-nix.materialize ({
materialized = if __pathExists materializedPath
then materializedPath
else null;
@ -88,9 +88,9 @@ let
# The nix produced by `cabalProject` differs slightly depending on
# what the platforms are. There are currently 3 possible outputs.
ghc-extra-projects-type =
if self.stdenv.hostPlatform.isWindows
if final.stdenv.hostPlatform.isWindows
then "windows"
else if self.stdenv.buildPlatform != self.stdenv.hostPlatform
else if final.stdenv.buildPlatform != final.stdenv.hostPlatform
then "cross"
else "default";
@ -113,7 +113,7 @@ in rec {
ghc-boot-packages-sdist-and-nix = builtins.mapAttrs
(ghcName: value: builtins.mapAttrs
(pkgName: dir: cabalToSdistAndNix ghcName pkgName "${value.passthru.configured-src}/${dir}") ghc-extra-pkgs)
self.buildPackages.haskell-nix.compiler;
final.buildPackages.haskell-nix.compiler;
# All the ghc boot package nix files for each ghc.
ghc-boot-packages-nix = builtins.mapAttrs
@ -134,14 +134,14 @@ in rec {
let package-locs =
# TODO ghc-heap.cabal requires cabal 3. We should update the cabalProject' call
# in `ghc-extra-projects` below to work with this.
(self.lib.filterAttrs (n: _: n != "base" && n != "ghc-heap") ghc-extra-pkgs);
in self.stdenv.mkDerivation {
(final.lib.filterAttrs (n: _: n != "base" && n != "ghc-heap") ghc-extra-pkgs);
in final.stdenv.mkDerivation {
name = "ghc-extra-pkgs-cabal-project-${name}";
phases = [ "buildPhase" ];
# Copy each cabal file from the configured ghc source and
# add a suitable cabal.project file.
buildPhase = ''
${self.lib.concatStrings (self.lib.mapAttrsToList (_: dir: ''
${final.lib.concatStrings (final.lib.mapAttrsToList (_: dir: ''
mkdir -p $out/${dir}
cp ${value.passthru.configured-src}/${dir}/*.cabal $out/${dir}
# Remove references to libffi as the are not cross platform
@ -149,7 +149,7 @@ in rec {
sed -i 's|/nix/store/.*-libffi.*/include||' $out/${dir}/*.cabal
'') package-locs)}
cat >$out/cabal.project <<EOF
packages: ${self.lib.concatStringsSep " " (self.lib.attrValues package-locs)}
packages: ${final.lib.concatStringsSep " " (final.lib.attrValues package-locs)}
-- need this for libiserve as it doesn't build against 3.0 yet.
constraints: network < 3.0,
ghc +ghci,
@ -157,22 +157,22 @@ in rec {
libiserv +network
EOF
'';
}) self.buildPackages.haskell-nix.compiler;
}) final.buildPackages.haskell-nix.compiler;
# A `cabalProject'` project for each ghc
ghc-extra-projects = builtins.mapAttrs (ghcName: proj:
# Where to look for materialization files
let materializedPath = ../materialized/ghc-extra-projects
+ "/${ghc-extra-projects-type}/${ghcName}";
in self.haskell-nix.cabalProject' {
in final.haskell-nix.cabalProject' {
name = "ghc-extra-projects-${ghc-extra-projects-type}-${ghcName}";
src = proj;
index-state = self.haskell-nix.internalHackageIndexState;
index-state = final.haskell-nix.internalHackageIndexState;
materialized =
if __pathExists materializedPath
then materializedPath
else null;
ghc = self.buildPackages.haskell-nix.compiler.${ghcName};
ghc = final.buildPackages.haskell-nix.compiler.${ghcName};
configureArgs = "--disable-tests"; # avoid failures satisfying bytestring package tests dependencies
})
ghc-extra-pkgs-cabal-projects;

View File

@ -1,13 +1,13 @@
self: super: with super;
final: prev: with prev;
# sadly we need to patch GHC a bit.
let
ghcPkgOverrides = {
enableIntegerSimple = false;
} // lib.optionalAttrs self.stdenv.hostPlatform.isAarch32 {
} // lib.optionalAttrs final.stdenv.hostPlatform.isAarch32 {
enableRelocatableStaticLibs = false;
};
ghcDrvOverrides = drv: {
hardeningDisable = (drv.hardeningDisable or []) ++ [ "stackprotector" "format" ] ++ lib.optionals super.stdenv.hostPlatform.isAarch32 [ "pic" "pie" ];
hardeningDisable = (drv.hardeningDisable or []) ++ [ "stackprotector" "format" ] ++ lib.optionals prev.stdenv.hostPlatform.isAarch32 [ "pic" "pie" ];
};
in {
haskell-nix = let
@ -17,7 +17,7 @@ self: super: with super;
# we want to apply this only to non-ghcjs ones.
# As we do some ghc <- ghcjs mapping for ghcjs.
needsPatches = name:
!(super.stdenv.targetPlatform.isGhcjs or false)
!(prev.stdenv.targetPlatform.isGhcjs or false)
&& lib.hasPrefix "ghc" name
&& !lib.hasPrefix "ghc82" name
&& !lib.hasPrefix "ghcjs" name
@ -25,8 +25,8 @@ self: super: with super;
overrideCompiler = compiler:
(compiler.override ghcPkgOverrides).overrideAttrs ghcDrvOverrides;
in
lib.recursiveUpdate super.haskell-nix {
lib.recursiveUpdate prev.haskell-nix {
compiler = lib.mapAttrs (_name: overrideCompiler)
(lib.filterAttrs (name: _value: needsPatches name) super.haskell-nix.compiler);
(lib.filterAttrs (name: _value: needsPatches name) prev.haskell-nix.compiler);
};
}

View File

@ -1,6 +1,6 @@
# This overlay does *not* work as expected.
# See https://github.com/NixOS/nixpkgs/issues/65589
self: super: super.lib.recursiveUpdate super {
final: prev: prev.lib.recursiveUpdate prev {
lib.systems.examples = {
# Ghcjs
ghcjs = {
@ -17,15 +17,15 @@ self: super: super.lib.recursiveUpdate super {
platform = {};
};
};
# gcc = if self.targetPlatform.isGhcjs then null else super.gcc;
lib.systems.parse = with self.lib.systems.parse; {
# gcc = if final.targetPlatform.isGhcjs then null else prev.gcc;
lib.systems.parse = with final.lib.systems.parse; {
cpuTypes.js = cpuTypes.wasm32 // { name = "js"; family = "js"; };
kernels.ghcjs = kernels.none // { name = "ghcjs"; };
kernels.asterius = kernels.none // { name = "asterius"; };
mkSkeletonFromList = l: builtins.trace l (super.lib.systems.parse.mkSkeletonFromList l);
mkSystemFromString = s: builtins.trace s (super.lib.systems.parse.mkSystemFromString s);
mkSkeletonFromList = l: builtins.trace l (prev.lib.systems.parse.mkSkeletonFromList l);
mkSystemFromString = s: builtins.trace s (prev.lib.systems.parse.mkSystemFromString s);
};
lib.systems.inspect.patterns = with self.lib.systems.parse; {
lib.systems.inspect.patterns = with final.lib.systems.parse; {
isJavaScript = { cpu = cpuTypes.js; };
isWasm32 = { cpu = cpuTypes.wasm32; };
isWasm64 = { cpu = cpuTypes.wasm64; };

View File

@ -2,11 +2,11 @@
# arguments for `haskell-nix.hackage-project` and the functions
# that use it (like `hackage-package`)
#
self: super:
final: prev:
let
inherit (self) lib;
inherit (final) lib;
in { haskell-nix = super.haskell-nix // {
in { haskell-nix = prev.haskell-nix // {
hackageQuirks = { name, version }: {
# FIXME: this is required to build cabal-install 3.2 with ghc 8.6,
@ -38,16 +38,16 @@ in { haskell-nix = super.haskell-nix // {
# Windows characters confuse cross compilation
# See https://github.com/snoyberg/file-embed/pull/33
(lib.optionalAttrs (version == "2.9.2.1") {
packages.file-embed.src = self.fetchgit {
packages.file-embed.src = final.fetchgit {
url = "https://github.com/hamishmack/file-embed.git";
rev = "12b33b8b710517308954c1facff3dc679c2dc5e3";
sha256 = "0jcpja4s4cylmg9rddyakb1p1fb4l41ffwmy0njpb1dxc5z3v618";
};
})
# Musl needs static zlib
(lib.optionalAttrs self.stdenv.hostPlatform.isMusl {
(lib.optionalAttrs final.stdenv.hostPlatform.isMusl {
packages.pandoc.components.exes.pandoc.configureFlags = [
"--ghc-option=-optl=-L${self.zlib.static}/lib"
"--ghc-option=-optl=-L${final.zlib.static}/lib"
];
})
];

View File

@ -2,8 +2,8 @@
#
# for hygenic reasons we'll use haskell-nix as a prefix.
# Using haskell.nix in nix is awkward as I needs to be quoted.
self: super: {
haskell-nix = with self.haskell-nix; {
final: prev: {
haskell-nix = with final.haskell-nix; {
# Default modules, these will always be included.
# They are here to be overridden/added to by other
@ -13,7 +13,7 @@ self: super: {
# We provide a `callPackage` function to consumers for
# convenience. We will however refrain from using it
# here and be explicit about imports and dependencies.
callPackage = super.lib.callPackageWith (self // self.haskell-nix);
callPackage = prev.lib.callPackageWith (final // final.haskell-nix);
# You can provide different pins for hackage.nix and stackage.nix if required.
# It's also possible to override these sources with NIX_PATH.
@ -32,7 +32,7 @@ self: super: {
fetchExternal = import ../lib/fetch-external.nix;
# Functions for cleaning Haskell source directories.
inherit (import ../lib/clean-source-haskell.nix { inherit (self) lib; })
inherit (import ../lib/clean-source-haskell.nix { inherit (final) lib; })
haskellSourceFilter
cleanSourceHaskell;
@ -59,8 +59,8 @@ self: super: {
# Utility functions for working with the component builder.
haskellLib = let hl = import ../lib {
inherit (self) stdenv lib runCommand recurseIntoAttrs srcOnly;
inherit (self.buildPackages) git;
inherit (final) stdenv lib runCommand recurseIntoAttrs srcOnly;
inherit (final.buildPackages) git;
haskellLib = hl;
}; in hl;
@ -80,7 +80,7 @@ self: super: {
import ../package-set.nix {
inherit (args) pkg-def pkg-def-extras;
modules = defaultModules ++ modules;
pkgs = self;
pkgs = final;
hackage = hackageAll;
};
@ -89,10 +89,10 @@ self: super: {
# info. Instead we can add ghc-boot-packages to `pkg-def-extras`.
excludeBootPackages = pkg-def: hackage:
let original = pkg-def hackage;
bootPkgNames = self.lib.attrNames
self.ghc-boot-packages.${(pkg-def hackage).compiler.nix-name};
bootPkgNames = final.lib.attrNames
final.ghc-boot-packages.${(pkg-def hackage).compiler.nix-name};
in original // {
packages = self.lib.filterAttrs (n: _: self.lib.all (b: n != b) bootPkgNames)
packages = final.lib.filterAttrs (n: _: final.lib.all (b: n != b) bootPkgNames)
original.packages;
};
@ -119,7 +119,7 @@ self: super: {
in mkPkgSet {
pkg-def = excludeBootPackages pkg-def;
pkg-def-extras = [ stack-pkgs.extras
self.ghc-boot-packages.${compiler.nix-name}
final.ghc-boot-packages.${compiler.nix-name}
]
++ pkg-def-extras;
# set doExactConfig = true. The stackage set should be consistent
@ -145,7 +145,7 @@ self: super: {
in mkPkgSet {
inherit pkg-def;
pkg-def-extras = [ plan-pkgs.extras
self.ghc-boot-packages.${compiler.nix-name}
final.ghc-boot-packages.${compiler.nix-name}
]
++ pkg-def-extras;
# set doExactConfig = true, as we trust cabals resolution for
@ -157,7 +157,7 @@ self: super: {
};
# Package sets for all stackage snapshots.
snapshots = import ../snapshots.nix { inherit (self) lib ghc-boot-packages; inherit mkPkgSet stackage excludeBootPackages; };
snapshots = import ../snapshots.nix { inherit (final) lib ghc-boot-packages; inherit mkPkgSet stackage excludeBootPackages; };
# Pick a recent LTS snapshot to be our "default" package set.
haskellPackages = snapshots."lts-14.13";
@ -165,26 +165,26 @@ self: super: {
# files. This version of nix-tools may be cross compiled.
# We probably never want to actually cross compile nix-tools on
# it's own.
nix-tools-cross-compiled = self.lib.makeOverridable (import ../nix-tools) {
inherit (self) pkgs lib symlinkJoin makeWrapper
nix-tools-cross-compiled = final.lib.makeOverridable (import ../nix-tools) {
inherit (final) pkgs lib symlinkJoin makeWrapper
git nix nix-prefetch-git;
inherit (self.haskell-nix) fetchExternal cleanSourceHaskell mkCabalProjectPkgSet;
inherit (final.haskell-nix) fetchExternal cleanSourceHaskell mkCabalProjectPkgSet;
hpack = null; # nix-tools does not use hpack project files
};
# While `nix-tools-cross-compiled` may be cross compiled,
# getting it from `buildPackages` we should get
# nix-tools suitable for running on the build system.
nix-tools = self.buildPackages.haskell-nix.nix-tools-cross-compiled;
nix-tools = final.buildPackages.haskell-nix.nix-tools-cross-compiled;
# TODO perhaps there is a cleaner way to get a suitable nix-tools.
# Produce a fixed output derivation from a moving target (hackage index tarball)
# Takes desired index-state and sha256 and produces a set { name, index }, where
# index points to "01-index.tar.gz" file downloaded from hackage.haskell.org.
hackageTarball = { index-state, sha256, nix-tools ? self.haskell-nix.nix-tools, ... }:
hackageTarball = { index-state, sha256, nix-tools ? final.haskell-nix.nix-tools, ... }:
assert sha256 != null;
let at = builtins.replaceStrings [":"] [""] index-state; in
{ name = "hackage.haskell.org-at-${at}";
index = self.fetchurl {
index = final.fetchurl {
name = "01-index.tar.gz-at-${at}";
url = "https://hackage.haskell.org/01-index.tar.gz";
downloadToTemp = true;
@ -196,20 +196,20 @@ self: super: {
};
# Creates Cabal local repository from { name, index } set.
mkLocalHackageRepo = import ../mk-local-hackage-repo self;
mkLocalHackageRepo = import ../mk-local-hackage-repo final;
dotCabal = { index-state, sha256, cabal-install, extra-hackage-tarballs ? [], ... }@args:
let
allTarballs = [ (hackageTarball args) ] ++ extra-hackage-tarballs;
allNames = self.lib.concatMapStringsSep "-" (tarball: tarball.name) allTarballs;
allNames = final.lib.concatMapStringsSep "-" (tarball: tarball.name) allTarballs;
# Main Hackage index-state is embedded in its name and thus will propagate to
# dotCabalName anyway.
dotCabalName = "dot-cabal-" + allNames;
in
self.runCommand dotCabalName { nativeBuildInputs = [ cabal-install ]; } ''
final.runCommand dotCabalName { nativeBuildInputs = [ cabal-install ]; } ''
mkdir -p $out/.cabal
cat <<EOF > $out/.cabal/config
${self.lib.concatStrings (
${final.lib.concatStrings (
map (tarball:
''
repository ${tarball.name}
@ -224,11 +224,11 @@ self: super: {
# All repositories must be mkdir'ed before calling new-update on any repo,
# otherwise it fails.
${self.lib.concatStrings (map ({ name, ... }: ''
${final.lib.concatStrings (map ({ name, ... }: ''
mkdir -p $out/.cabal/packages/${name}
'') allTarballs)}
${self.lib.concatStrings (map ({ name, ... }: ''
${final.lib.concatStrings (map ({ name, ... }: ''
HOME=$out cabal new-update ${name}
'') allTarballs)}
'';
@ -245,31 +245,31 @@ self: super: {
# Helps materialize the output of derivations
materialize = import ../lib/materialize.nix {
inherit (self.buildPackages) nix;
inherit (self.haskell-nix) checkMaterialization;
pkgs = self.buildPackages.pkgs;
inherit (self.buildPackages.pkgs) runCommand;
inherit (final.buildPackages) nix;
inherit (final.haskell-nix) checkMaterialization;
pkgs = final.buildPackages.pkgs;
inherit (final.buildPackages.pkgs) runCommand;
};
update-index-state-hashes = import ../scripts/update-index-state-hashes.nix {
inherit (self.haskell-nix) indexStateHashesPath nix-tools;
inherit (self) coreutils nix writeShellScriptBin stdenv curl;
inherit (final.haskell-nix) indexStateHashesPath nix-tools;
inherit (final) coreutils nix writeShellScriptBin stdenv curl;
};
# Function to call stackToNix
callStackToNix = import ../lib/call-stack-to-nix.nix {
pkgs = self.buildPackages.pkgs;
inherit (self.buildPackages.pkgs) runCommand;
inherit (self.buildPackages.haskell-nix) nix-tools mkCacheFile materialize;
pkgs = final.buildPackages.pkgs;
inherit (final.buildPackages.pkgs) runCommand;
inherit (final.buildPackages.haskell-nix) nix-tools mkCacheFile materialize;
};
# given a source location call `cabal-to-nix` (from nix-tools) on it
# to produce the nix representation of it.
callCabalToNix = { name, src, cabal-file ? "${name}.cabal" }:
self.buildPackages.pkgs.runCommand "${name}.nix" {
nativeBuildInputs = [ self.buildPackages.haskell-nix.nix-tools ];
final.buildPackages.pkgs.runCommand "${name}.nix" {
nativeBuildInputs = [ final.buildPackages.haskell-nix.nix-tools ];
LOCALE_ARCHIVE = self.lib.optionalString (self.stdenv.buildPlatform.libc == "glibc") "${self.buildPackages.glibcLocales}/lib/locale/locale-archive";
LOCALE_ARCHIVE = final.lib.optionalString (final.stdenv.buildPlatform.libc == "glibc") "${final.buildPackages.glibcLocales}/lib/locale/locale-archive";
LANG = "en_US.UTF-8";
LC_ALL = "en_US.UTF-8";
} ''
@ -297,7 +297,7 @@ self: super: {
assert isNull sha256;
builtins.fetchGit
({ inherit url rev; } //
self.buildPackages.lib.optionalAttrs (ref != null) { inherit ref; }
final.buildPackages.lib.optionalAttrs (ref != null) { inherit ref; }
)
else
# Non-private repos must have sha256 set.
@ -305,7 +305,7 @@ self: super: {
# pkgs.fetchgit doesn't have any way of fetching from a given
# ref.
assert isNull ref;
self.buildPackages.pkgs.fetchgit {
final.buildPackages.pkgs.fetchgit {
url = url;
rev = rev;
sha256 = sha256;
@ -318,20 +318,20 @@ self: super: {
nix-expr =
if type == "cabal"
then
self.buildPackages.haskell-nix.callCabalToNix {
final.buildPackages.haskell-nix.callCabalToNix {
src = repoWithSubdir;
inherit name cabal-file;
}
else if type == "stack"
then
(self.buildPackages.haskell-nix.callStackToNix {
(final.buildPackages.haskell-nix.callStackToNix {
src = repoWithSubdir;
inherit name subdir;
}).projectNix
else
throw "Unknown type '${type}` for a cache entry";
sha256String = if isNull sha256 then self.buildPackages.lib.fakeSha256 else sha256;
sha256String = if isNull sha256 then final.buildPackages.lib.fakeSha256 else sha256;
in {
line = "${url} ${rev} ${subdir} ${sha256String} ${name}";
@ -347,24 +347,24 @@ self: super: {
# the results of `stack-to-nix` can be imported in restrected eval
# mode.
mkCacheFile = repos:
self.buildPackages.pkgs.runCommand "cache-file" {} ''
final.buildPackages.pkgs.runCommand "cache-file" {} ''
mkdir -p $out
touch $out/.stack-to-nix.cache
${self.lib.concatStrings (
self.lib.lists.zipListsWith (n: repo:
${final.lib.concatStrings (
final.lib.lists.zipListsWith (n: repo:
let l = mkCacheLine repo;
in ''
cp ${l.nix-expr} $out/.stack-to-nix.cache.${toString n}
echo ${l.line} .stack-to-nix.cache.${toString n} >> $out/.stack-to-nix.cache
'')
(self.lib.lists.range 0 ((builtins.length repos) - 1))
(final.lib.lists.range 0 ((builtins.length repos) - 1))
repos)
}
'';
genStackCache = import ../lib/stack-cache-generator.nix {
inherit (self.buildPackages) pkgs;
inherit (self.buildPackages.haskell-nix) haskellLib nix-tools;
inherit (final.buildPackages) pkgs;
inherit (final.buildPackages.haskell-nix) haskellLib nix-tools;
};
mkCacheModule = cache:
@ -391,11 +391,11 @@ self: super: {
then
builtins.fetchGit
({ inherit url rev; } //
self.buildPackages.lib.optionalAttrs (ref != null) { inherit ref; }
final.buildPackages.lib.optionalAttrs (ref != null) { inherit ref; }
)
else
self.buildPackages.pkgs.fetchgit { inherit url rev sha256; };
} // self.buildPackages.lib.optionalAttrs (subdir != null) { postUnpack = "sourceRoot+=/${subdir}; echo source root reset to $sourceRoot"; };
final.buildPackages.pkgs.fetchgit { inherit url rev sha256; };
} // final.buildPackages.lib.optionalAttrs (subdir != null) { postUnpack = "sourceRoot+=/${subdir}; echo source root reset to $sourceRoot"; };
};
cacheMap = builtins.map repoToAttr cache;
@ -408,23 +408,23 @@ self: super: {
# Resulting nix files are added to nix-plan subdirectory.
callCabalProjectToNix = import ../lib/call-cabal-project-to-nix.nix {
index-state-hashes = import indexStateHashesPath;
inherit (self.buildPackages.haskell-nix) dotCabal nix-tools haskellLib materialize;
pkgs = self.buildPackages.pkgs;
inherit (self.buildPackages.haskell-nix.haskellPackages.hpack.components.exes) hpack;
inherit (self.buildPackages.haskell-nix) cabal-install ghc;
inherit (self.buildPackages.pkgs) runCommand symlinkJoin cacert;
inherit (final.buildPackages.haskell-nix) dotCabal nix-tools haskellLib materialize;
pkgs = final.buildPackages.pkgs;
inherit (final.buildPackages.haskell-nix.haskellPackages.hpack.components.exes) hpack;
inherit (final.buildPackages.haskell-nix) cabal-install ghc;
inherit (final.buildPackages.pkgs) runCommand symlinkJoin cacert;
};
# Loads a plan and filters the package directories using cleanSourceWith
importAndFilterProject = import ../lib/import-and-filter-project.nix {
inherit (self.buildPackages.haskell-nix) haskellLib;
pkgs = self.buildPackages.pkgs;
inherit (final.buildPackages.haskell-nix) haskellLib;
pkgs = final.buildPackages.pkgs;
};
# References to the unpacked sources, for caching in a Hydra jobset.
source-pins = import ../lib/make-source-pins.nix {
inherit (self) lib writeTextFile;
sources = [ hackageSrc stackageSrc self.path ];
inherit (final) lib writeTextFile;
sources = [ hackageSrc stackageSrc final.path ];
};
# -- IFDs --
@ -440,17 +440,17 @@ self: super: {
{ name
, version
, ... }@args:
let tarball = self.pkgs.fetchurl {
let tarball = final.pkgs.fetchurl {
url = "mirror://hackage/${name}-${version}.tar.gz";
inherit (hackage.${name}.${version}) sha256; };
in let src = self.buildPackages.pkgs.runCommand "${name}-${version}-src" { } ''
in let src = final.buildPackages.pkgs.runCommand "${name}-${version}-src" { } ''
tmp=$(mktemp -d)
cd $tmp
tar xzf ${tarball}
mv "${name}-${version}" $out
'';
in cabalProject' (
(self.haskell-nix.hackageQuirks { inherit name version; }) //
(final.haskell-nix.hackageQuirks { inherit name version; }) //
builtins.removeAttrs args [ "version" ] // { inherit src; });
# This function is like `cabalProject` but it makes the plan-nix available
@ -463,7 +463,7 @@ self: super: {
{ plan-pkgs = plan.pkgs;
pkg-def-extras = args.pkg-def-extras or [];
modules = (args.modules or [])
++ self.lib.optional (args ? ghc) { ghc.package = args.ghc; };
++ final.lib.optional (args ? ghc) { ghc.package = args.ghc; };
extra-hackages = args.extra-hackages or [];
};
in { inherit (pkg-set.config) hsPkgs; inherit pkg-set; plan-nix = plan.nix; };
@ -487,9 +487,9 @@ self: super: {
in let pkg-set = mkStackPkgSet
{ stack-pkgs = stack.pkgs;
pkg-def-extras = (args.pkg-def-extras or []);
modules = self.lib.singleton (mkCacheModule cache)
modules = final.lib.singleton (mkCacheModule cache)
++ (args.modules or [])
++ self.lib.optional (args ? ghc) { ghc.package = args.ghc; };
++ final.lib.optional (args ? ghc) { ghc.package = args.ghc; };
};
in { inherit (pkg-set.config) hsPkgs; inherit pkg-set; stack-nix = stack.nix; };
@ -504,7 +504,7 @@ self: super: {
# Like `cabalProject'`, but for building the GHCJS compiler.
# This is exposed to allow GHCJS developers to work on the GHCJS
# code in a nix-shell with `shellFor`.
ghcjsProject = import ../lib/ghcjs-project.nix { pkgs = self; };
ghcjsProject = import ../lib/ghcjs-project.nix { pkgs = final; };
# The functions that return a plan-nix often have a lot of dependencies
# that could be GCed and also will not make it into hydra cache.
@ -513,47 +513,47 @@ self: super: {
# project = cabalProject' {...};
# In your tests module add something that is effectively
# testProjectPlan = withInputs project.plan-nix;
withInputs = self.recurseIntoAttrs;
withInputs = final.recurseIntoAttrs;
# Add this to your tests to make all the dependencies of haskell.nix
# are tested and cached.
haskellNixRoots = self.recurseIntoAttrs {
haskellNixRoots = final.recurseIntoAttrs {
Level0 = haskellNixRoots' 0;
Level1 = haskellNixRoots' 1;
};
haskellNixRoots' = ifdLevel:
let filterSupportedGhc = self.lib.filterAttrs (n: _: n == "ghc865" || n == "ghc883");
in self.recurseIntoAttrs ({
let filterSupportedGhc = final.lib.filterAttrs (n: _: n == "ghc865" || n == "ghc883");
in final.recurseIntoAttrs ({
# Things that require no IFD to build
inherit (self.buildPackages.haskell-nix) nix-tools source-pins;
bootstap-nix-tools = self.buildPackages.haskell-nix.bootstrap.packages.nix-tools;
alex-plan-nix = withInputs self.buildPackages.haskell-nix.bootstrap.packages.alex-project.plan-nix;
happy-plan-nix = withInputs self.buildPackages.haskell-nix.bootstrap.packages.happy-project.plan-nix;
hscolour-plan-nix = withInputs self.buildPackages.haskell-nix.bootstrap.packages.hscolour-project.plan-nix;
} // self.lib.optionalAttrs (ifdLevel > 0) {
inherit (final.buildPackages.haskell-nix) nix-tools source-pins;
bootstap-nix-tools = final.buildPackages.haskell-nix.bootstrap.packages.nix-tools;
alex-plan-nix = withInputs final.buildPackages.haskell-nix.bootstrap.packages.alex-project.plan-nix;
happy-plan-nix = withInputs final.buildPackages.haskell-nix.bootstrap.packages.happy-project.plan-nix;
hscolour-plan-nix = withInputs final.buildPackages.haskell-nix.bootstrap.packages.hscolour-project.plan-nix;
} // final.lib.optionalAttrs (ifdLevel > 0) {
# Things that require one IFD to build (the inputs should be in level 0)
alex = self.buildPackages.haskell-nix.bootstrap.packages.alex;
happy = self.buildPackages.haskell-nix.bootstrap.packages.happy;
hscolour = self.buildPackages.haskell-nix.bootstrap.packages.hscolour;
ghc865 = self.buildPackages.haskell-nix.compiler.ghc865;
ghc883 = self.buildPackages.haskell-nix.compiler.ghc883;
ghc-boot-packages-nix = self.recurseIntoAttrs
(builtins.mapAttrs (_: self.recurseIntoAttrs)
(filterSupportedGhc self.ghc-boot-packages-nix));
ghc-extra-projects = self.recurseIntoAttrs (builtins.mapAttrs (_: proj: withInputs proj.plan-nix)
(filterSupportedGhc self.ghc-extra-projects));
} // self.lib.optionalAttrs (ifdLevel > 1) {
alex = final.buildPackages.haskell-nix.bootstrap.packages.alex;
happy = final.buildPackages.haskell-nix.bootstrap.packages.happy;
hscolour = final.buildPackages.haskell-nix.bootstrap.packages.hscolour;
ghc865 = final.buildPackages.haskell-nix.compiler.ghc865;
ghc883 = final.buildPackages.haskell-nix.compiler.ghc883;
ghc-boot-packages-nix = final.recurseIntoAttrs
(builtins.mapAttrs (_: final.recurseIntoAttrs)
(filterSupportedGhc final.ghc-boot-packages-nix));
ghc-extra-projects = final.recurseIntoAttrs (builtins.mapAttrs (_: proj: withInputs proj.plan-nix)
(filterSupportedGhc final.ghc-extra-projects));
} // final.lib.optionalAttrs (ifdLevel > 1) {
# Things that require two levels of IFD to build (inputs should be in level 1)
inherit (self.haskell-nix) nix-tools;
inherit (final.haskell-nix) nix-tools;
# These seem to be the only things we use from `ghc-extra-packages`
# in haskell.nix itself.
iserv-proxy = self.recurseIntoAttrs
# in haskell.nix itfinal.
iserv-proxy = final.recurseIntoAttrs
(builtins.mapAttrs (_: pkgs: pkgs.iserv-proxy.components.exes.iserv-proxy)
(filterSupportedGhc self.ghc-extra-packages));
remote-iserv = self.recurseIntoAttrs
(filterSupportedGhc final.ghc-extra-packages));
remote-iserv = final.recurseIntoAttrs
(builtins.mapAttrs (_: pkgs: pkgs.remote-iserv.components.exes.remote-iserv)
(filterSupportedGhc self.ghc-extra-packages));
(filterSupportedGhc final.ghc-extra-packages));
});
};
}

View File

@ -1,10 +1,10 @@
self: super: super.lib.optionalAttrs super.stdenv.hostPlatform.isMusl {
final: prev: prev.lib.optionalAttrs prev.stdenv.hostPlatform.isMusl {
# On nixpkgs 19.09 openssl is configured as `linux-generic64` instead
# of `linux-x86_64` and as a result the `asm` parts of of openssl
# are not built. Because the `no_asm` configure flag is also not passed
# the c versions of the functions are also not included.
openssl = super.openssl.overrideAttrs (attrs:
super.lib.optionalAttrs super.stdenv.hostPlatform.isx86_64 {
openssl = prev.openssl.overrideAttrs (attrs:
prev.lib.optionalAttrs prev.stdenv.hostPlatform.isx86_64 {
configureScript = "./Configure linux-x86_64";
});
}

View File

@ -1,8 +1,8 @@
(self: super: {
(final: prev: {
# See nixpkgs#51135
python37 = super.python37.override {
packageOverrides = python-self: python-super: {
docutils = python-super.docutils.overrideAttrs (oldAttrs: {
python37 = prev.python37.override {
packageOverrides = python-final: python-prev: {
docutils = python-prev.docutils.overrideAttrs (oldAttrs: {
LC_CTYPE = "en_US.UTF-8";
LANG = "en_US.UTF-8";
});

View File

@ -31,11 +31,11 @@
# ghc = haskell-nix.compiler.ghc883;
# }
#
self: super:
final: prev:
let
inherit (self) lib;
inherit (final) lib;
in { haskell-nix = super.haskell-nix // {
in { haskell-nix = prev.haskell-nix // {
# Some times the package name in hackage is not the same as tool name.
toolPackageName = {
@ -43,37 +43,37 @@ in { haskell-nix = super.haskell-nix // {
};
hackage-tool = { name, ... }@args:
(self.haskell-nix.hackage-package
(args // { name = self.haskell-nix.toolPackageName."${name}" or name; }))
(final.haskell-nix.hackage-package
(args // { name = final.haskell-nix.toolPackageName."${name}" or name; }))
.components.exes."${name}";
tool = name: versionOrArgs:
let
args = self.haskell-nix.haskellLib.versionOrArgsToArgs versionOrArgs;
args = final.haskell-nix.haskellLib.versionOrArgsToArgs versionOrArgs;
in
(if self.haskell-nix.custom-tools ? "${name}"
&& self.haskell-nix.custom-tools."${name}" ? "${args.version}"
then self.haskell-nix.custom-tools."${name}"."${args.version}"
else self.haskell-nix.hackage-tool) (args // { inherit name; });
(if final.haskell-nix.custom-tools ? "${name}"
&& final.haskell-nix.custom-tools."${name}" ? "${args.version}"
then final.haskell-nix.custom-tools."${name}"."${args.version}"
else final.haskell-nix.hackage-tool) (args // { inherit name; });
tools = lib.mapAttrs self.haskell-nix.tool;
tools = lib.mapAttrs final.haskell-nix.tool;
# Like `tools` but allows default ghc to be specified
toolsForGhc = ghc: toolSet:
self.haskell-nix.tools (
final.haskell-nix.tools (
lib.mapAttrs (name: versionOrArgs:
# Add default ghc if not specified in the args
{ inherit ghc; }
// self.haskell-nix.haskellLib.versionOrArgsToArgs versionOrArgs
// final.haskell-nix.haskellLib.versionOrArgsToArgs versionOrArgs
) toolSet
);
# Tools not in hackage yet
custom-tools = {
ghcide.object-code = args:
(self.haskell-nix.cabalProject (args // {
(final.haskell-nix.cabalProject (args // {
name = "ghcide";
src = self.fetchFromGitHub {
src = final.fetchFromGitHub {
owner = "mpickering";
repo = "ghcide";
rev = "706c59c97c25c66798815c1dc3ee6885a298918a";

View File

@ -2,30 +2,30 @@
# conditionals need to be in the leafs! If we attach the conditional to the root
# node (e.g. the whole customization here), they will be evaluated at the wrong time
# and not end up with the expected changes we want.
self: super:
final: prev:
{
# on windows we have this habit of putting libraries
# into `bin`, wheras on unix it's usually `lib`. For
# this confuses nix easily. So we'll just move the
# .dll's from `bin` into `$out/lib`. Such that they
# are trivially found.
# openssl = super.openssl.overrideAttrs (drv: {
# # postInstall = with super.stdenv; drv.postInstall + lib.optionalString hostPlatform.isWindows ''
# openssl = prev.openssl.overrideAttrs (drv: {
# # postInstall = with prev.stdenv; drv.postInstall + lib.optionalString hostPlatform.isWindows ''
# # cp $bin/bin/*.dll $out/lib/
# # '';
# postFixup = "";
# });
mfpr = super.mfpr.overrideAttrs (drv: {
configureFlags = (drv.configureFlags or []) ++ super.stdenv.lib.optional super.stdenv.hostPlatform.isWindows "--enable-static --disable-shared" ;
mfpr = prev.mfpr.overrideAttrs (drv: {
configureFlags = (drv.configureFlags or []) ++ prev.stdenv.lib.optional prev.stdenv.hostPlatform.isWindows "--enable-static --disable-shared" ;
});
libmpc = super.libmpc.overrideAttrs (drv: {
configureFlags = (drv.configureFlags or []) ++ super.stdenv.lib.optional super.stdenv.hostPlatform.isWindows "--enable-static --disable-shared" ;
libmpc = prev.libmpc.overrideAttrs (drv: {
configureFlags = (drv.configureFlags or []) ++ prev.stdenv.lib.optional prev.stdenv.hostPlatform.isWindows "--enable-static --disable-shared" ;
});
haskell-nix = super.haskell-nix // ({
defaultModules = super.haskell-nix.defaultModules ++ [
haskell-nix = prev.haskell-nix // ({
defaultModules = prev.haskell-nix.defaultModules ++ [
({ pkgs, buildModules, config, lib, ... }:
let
withTH = import ./mingw_w64.nix {
@ -37,10 +37,10 @@ self: super:
inherit (pkgs.buildPackages) symlinkJoin;
# iserv-proxy needs to come from the buildPackages, as it needs to run on the
# build host.
inherit (self.buildPackages.ghc-extra-packages."${config.compiler.nix-name}".iserv-proxy.components.exes) iserv-proxy;
inherit (final.buildPackages.ghc-extra-packages."${config.compiler.nix-name}".iserv-proxy.components.exes) iserv-proxy;
# remote-iserv however needs to come from the regular packages as it has to
# run on the target host.
inherit (self.ghc-extra-packages."${config.compiler.nix-name}".remote-iserv.components.exes) remote-iserv;
inherit (final.ghc-extra-packages."${config.compiler.nix-name}".remote-iserv.components.exes) remote-iserv;
# we need to use openssl.bin here, because the .dll's are in the .bin expression.
# extra-test-libs = [ pkgs.rocksdb pkgs.openssl.bin pkgs.libffi pkgs.gmp ];
} // {

View File

@ -1,13 +1,13 @@
# fix wine at 3.0.2; the 4.x branch breaks windows cross compilation.
# this will inevitably replace *any* wine version. Thus this might not
# really be what we ultimately want.
self: super:
final: prev:
{
winePackages = super.winePackages // {
minimal = super.winePackages.minimal.overrideAttrs (oldAttrs: {
winePackages = prev.winePackages // {
minimal = prev.winePackages.minimal.overrideAttrs (oldAttrs: {
name = "wine-3.21";
version = "3.21";
src = super.fetchurl {
src = prev.fetchurl {
url = "https://dl.winehq.org/wine/source/3.x/wine-3.21.tar.xz";
sha256 = "1h70wb7kysbzv36i3fblyiihvalwhy6sj4s2a8nf21nz2mhc0k58"; };
});