Skip to content

Commit 98468dd

Browse files
committed
Merge branch 'master' of github.com:input-output-hk/haskell.nix into circuithub
2 parents 7d482e9 + 10b58b7 commit 98468dd

File tree

374 files changed

+76085
-329
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

374 files changed

+76085
-329
lines changed

.github/workflows/lints.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
steps:
2626
- uses: actions/checkout@v3
2727
- run: |
28-
nix run github:astro/deadnix -- --edit --no-lambda-pattern-names
28+
nix run github:astro/deadnix -- --edit --no-lambda-pattern-names --exclude materialized
2929
TMPFILE=$(mktemp)
3030
git diff >"${TMPFILE}"
3131
git stash -u && git stash drop

build.nix

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ in rec {
2626
tools = pkgs.lib.optionalAttrs (ifdLevel >= 3) (
2727
pkgs.recurseIntoAttrs ({
2828
cabal-latest = tool compiler-nix-name "cabal" { inherit evalPackages; cabalProjectLocal = builtins.readFile ./test/cabal.project.local; };
29-
} // pkgs.lib.optionalAttrs (__compareVersions haskell.compiler.${compiler-nix-name}.version "9.6" < 0) {
29+
} // pkgs.lib.optionalAttrs (__compareVersions haskell.compiler.${compiler-nix-name}.version "9.8" < 0) {
3030
hlint-latest = tool compiler-nix-name "hlint" {
3131
inherit evalPackages;
3232
version = {
@@ -51,20 +51,45 @@ in rec {
5151
version = "2.11.1";
5252
inherit evalPackages;
5353
};
54-
} // pkgs.lib.optionalAttrs (__compareVersions haskell.compiler.${compiler-nix-name}.version "9.6" < 0) {
55-
"hls-110" = tool compiler-nix-name "haskell-language-server" {
54+
} // pkgs.lib.optionalAttrs (__compareVersions haskell.compiler.${compiler-nix-name}.version "9.0" < 0) {
55+
# This version will build for ghc < 9.8, but we are only going to test it for
56+
# ghc < 9.0 (since newer versions do not work with ghc 8.10.7).
57+
"hls-22" = tool compiler-nix-name "haskell-language-server" {
5658
inherit evalPackages;
57-
src = pkgs.haskell-nix.sources."hls-1.10";
59+
src = pkgs.haskell-nix.sources."hls-2.2";
5860
};
59-
} // pkgs.lib.optionalAttrs (__compareVersions haskell.compiler.${compiler-nix-name}.version "9.8" < 0) {
60-
"hls-20" = tool compiler-nix-name "haskell-language-server" {
61+
} // pkgs.lib.optionalAttrs (
62+
__compareVersions haskell.compiler.${compiler-nix-name}.version "9.0" >= 0 &&
63+
__compareVersions haskell.compiler.${compiler-nix-name}.version "9.8" < 0
64+
) {
65+
"hls-23" = tool compiler-nix-name "haskell-language-server" {
6166
inherit evalPackages;
62-
src = pkgs.haskell-nix.sources."hls-2.0";
67+
src = pkgs.haskell-nix.sources."hls-2.3";
6368
};
64-
} // pkgs.lib.optionalAttrs (__compareVersions haskell.compiler.${compiler-nix-name}.version "9.8" < 0) {
65-
"hls-22" = tool compiler-nix-name "haskell-language-server" {
69+
} // pkgs.lib.optionalAttrs (
70+
__compareVersions haskell.compiler.${compiler-nix-name}.version "9.0" >= 0 &&
71+
__compareVersions haskell.compiler.${compiler-nix-name}.version "9.9" < 0
72+
) {
73+
"hls-24" = tool compiler-nix-name "haskell-language-server" {
6674
inherit evalPackages;
67-
src = pkgs.haskell-nix.sources."hls-2.2";
75+
src = pkgs.haskell-nix.sources."hls-2.4";
76+
# Even though this is in the cabal.project it is inside a condional
77+
# and so haskell.nix cannot parse it properly. Luckily adding it
78+
# again seems to work fine.
79+
cabalProjectLocal = ''
80+
repository head.hackage.ghc.haskell.org
81+
url: https://ghc.gitlab.haskell.org/head.hackage/
82+
secure: True
83+
key-threshold: 3
84+
root-keys:
85+
f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89
86+
26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329
87+
7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d
88+
--sha256: sha256-aVI93DtHziicNn2mGli0YE+bC5BeT7mOQQETp2Thi68=
89+
90+
if impl(ghc < 9.7)
91+
active-repositories: hackage.haskell.org
92+
'';
6893
};
6994
})
7095
);

builder/comp-builder.nix

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ let self =
4545

4646
, enableStatic ? component.enableStatic
4747
, enableShared ? ghc.enableShared && component.enableShared && !haskellLib.isCrossHost
48+
, enableExecutableDynamic ? component.enableExecutableDynamic && !stdenv.hostPlatform.isMusl
4849
, enableDeadCodeElimination ? component.enableDeadCodeElimination
4950
, writeHieFiles ? component.writeHieFiles
5051

@@ -80,7 +81,7 @@ let self =
8081
, enableSeparateDataOutput ? component.enableSeparateDataOutput
8182

8283
# Prelinked ghci libraries; will make iserv faster; especially for static builds.
83-
, enableLibraryForGhci ? true
84+
, enableLibraryForGhci ? component.enableLibraryForGhci
8485

8586
# Debug
8687
, enableDebugRTS ? false
@@ -204,14 +205,14 @@ let
204205
(enableFeature enableProfiling "profiling")
205206
(enableFeature enableStatic "static")
206207
(enableFeature enableShared "shared")
208+
(enableFeature enableExecutableDynamic "executable-dynamic")
207209
(enableFeature doCoverage "coverage")
208210
(enableFeature (enableLibraryForGhci && !stdenv.hostPlatform.isGhcjs) "library-for-ghci")
209211
] ++ lib.optionals (stdenv.hostPlatform.isMusl && (haskellLib.isExecutableType componentId)) [
210212
# These flags will make sure the resulting executable is statically linked.
211213
# If it uses other libraries it may be necessary for to add more
212214
# `--ghc-option=-optl=-L` options to the `configureFlags` of the
213215
# component.
214-
"--disable-executable-dynamic"
215216
"--ghc-option=-optl=-pthread"
216217
"--ghc-option=-optl=-static"
217218
] ++ lib.optional enableSeparateDataOutput "--datadir=$data/share/${ghc.name}"

builder/make-config-files.nix

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,27 @@ let
6262
${target-pkg} init $configFiles/${packageCfgDir}
6363
6464
${lib.concatStringsSep "\n" (lib.mapAttrsToList flagsAndConfig {
65-
"extra-lib-dirs" = map (p: "${lib.getLib p}/lib") (lib.flatten component.libs)
66-
# On windows also include `bin` directories that may contain DLLs
67-
++ lib.optionals (stdenv.hostPlatform.isWindows)
68-
(map (p: "${lib.getBin p}/bin")
69-
(lib.flatten component.libs ++ lib.concatLists component.pkgconfig));
65+
"extra-lib-dirs" = map (p: "${lib.getLib p}/lib") (lib.flatten component.libs);
7066
"extra-include-dirs" = map (p: "${lib.getDev p}/include") (lib.flatten component.libs);
7167
"extra-framework-dirs" = lib.optionals (stdenv.hostPlatform.isDarwin)
7268
(map (p: "${p}/Library/Frameworks") component.frameworks);
7369
})}
70+
${
71+
# On windows also include `bin` directories that may contain DLLs
72+
# It might be tempting to use `builtins.pathExists` here instead of `if [ -d ]`,
73+
# however that would cause this detivation to depend on the output of the
74+
# library derivation.
75+
lib.concatStringsSep "\n" (map (p:
76+
let binDir = "${lib.getBin p}/bin";
77+
in ''
78+
if [ -d ${binDir} ]; then
79+
${lib.concatStringsSep "\n" (lib.mapAttrsToList flagsAndConfig {
80+
"extra-lib-dirs" = [binDir];
81+
})}
82+
fi
83+
'') (lib.optionals (stdenv.hostPlatform.isWindows)
84+
(lib.flatten component.libs ++ lib.concatLists component.pkgconfig))
85+
)}
7486
7587
unwrappedGhc=${ghc}
7688
ghcDeps=${ghc.cachedDeps
@@ -234,4 +246,4 @@ in {
234246
sed -i 's|/nix/store/|''${pkgroot}/../../../|' $configFiles/${packageCfgDir}/*.conf
235247
${target-pkg} -v0 --package-db $configFiles/${packageCfgDir} recache
236248
'';
237-
}
249+
}

ci.nix

Lines changed: 33 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@
2424
"unstable" = inputs.nixpkgs-unstable;
2525
};
2626

27-
ghc980X = pkgs: "ghc980${__substring 0 8 pkgs.haskell-nix.sources.ghc980.lastModifiedDate}";
28-
ghc99X = pkgs: "ghc99${__substring 0 8 pkgs.haskell-nix.sources.ghc99.lastModifiedDate}";
29-
3027
nixpkgsArgs = {
3128
# set checkMaterialization as per top-level argument
3229
overlays = [
@@ -47,75 +44,61 @@
4744
};
4845
};
4946

50-
compilerNixNames = nixpkgsName: nixpkgs:
51-
# Include only the GHC versions that are supported by haskell.nix
52-
nixpkgs.lib.filterAttrs (compiler-nix-name: _:
53-
# We have less x86_64-darwin build capacity so build fewer GhC versions
54-
(system != "x86_64-darwin" || (
55-
!builtins.elem compiler-nix-name ["ghc8104" "ghc810420210212" "ghc8105" "ghc8106" "ghc901" "ghc921" "ghc922"]))
56-
&&
57-
# aarch64-darwin requires ghc 8.10.7
58-
(system != "aarch64-darwin" || (
59-
!builtins.elem compiler-nix-name ["ghc865" "ghc884" "ghc8104" "ghc810420210212" "ghc8105" "ghc8106" "ghc901" "ghc921" "ghc922"]))
60-
&&
61-
# aarch64-linux requires ghc 8.8.4
62-
(system != "aarch64-linux" || (
63-
!builtins.elem compiler-nix-name ["ghc865" "ghc8104" "ghc810420210212" "ghc8105" "ghc8106" "ghc901" "ghc921" "ghc922"]
64-
)))
65-
(builtins.mapAttrs (_compiler-nix-name: runTests: {
66-
inherit runTests;
47+
compilerNixNames = nixpkgsName: nixpkgs: builtins.listToAttrs (
48+
(lib.mapAttrsToList (compiler-nix-name: runTests: {
49+
name = nixpkgs.haskell-nix.resolve-compiler-name compiler-nix-name;
50+
value = { inherit runTests; };
6751
}) (
6852
# GHC version to cache and whether to run the tests against them.
6953
# This list of GHC versions should include everything for which we
7054
# have a ./materialized/ghcXXX directory containing the materialized
7155
# cabal-install and nix-tools plans. When removing a ghc version
7256
# from here (so that is no longer cached) also remove ./materialized/ghcXXX.
7357
# Update supported-ghc-versions.md to reflect any changes made here.
74-
nixpkgs.lib.optionalAttrs (nixpkgsName == "R2211") {
75-
ghc8107 = false;
76-
ghc902 = false;
77-
ghc928 = false;
78-
ghc947 = false;
79-
} // nixpkgs.lib.optionalAttrs (nixpkgsName == "R2305") {
80-
ghc8107 = false;
81-
ghc902 = false;
82-
ghc928 = false;
83-
ghc947 = false;
84-
ghc962 = false;
58+
nixpkgs.lib.optionalAttrs (nixpkgsName == "R2305") {
59+
ghc810 = false;
60+
ghc90 = false;
61+
ghc92 = false;
62+
ghc94 = false;
63+
ghc96 = false;
64+
ghc98 = false;
8565
} // nixpkgs.lib.optionalAttrs (nixpkgsName == "unstable") {
86-
ghc884 = false;
87-
ghc8107 = true;
88-
ghc902 = false;
89-
ghc928 = true;
90-
ghc947 = true;
91-
ghc962 = true;
92-
ghc9820230704 = true;
93-
${ghc980X nixpkgs} = true;
94-
${ghc99X nixpkgs} = true;
95-
}));
66+
ghc810 = true;
67+
ghc90 = false;
68+
ghc92 = true;
69+
ghc94 = true;
70+
ghc96 = true;
71+
ghc98 = true;
72+
ghc98X = true;
73+
ghc99 = true;
74+
})));
9675
crossSystems = nixpkgsName: nixpkgs: compiler-nix-name:
9776
# We need to use the actual nixpkgs version we're working with here, since the values
9877
# of 'lib.systems.examples' are not understood between all versions
9978
let lib = nixpkgs.lib;
10079
in lib.optionalAttrs (nixpkgsName == "unstable"
101-
&& ((system == "x86_64-linux" && builtins.elem compiler-nix-name ["ghc8107" "ghc962" (ghc980X nixpkgs) (ghc99X nixpkgs)])
102-
|| (system == "aarch64-linux" && builtins.elem compiler-nix-name ["ghc8107" "ghc962" (ghc980X nixpkgs) (ghc99X nixpkgs)])
103-
|| (system == "x86_64-darwin" && builtins.elem compiler-nix-name ["ghc8107" "ghc962" (ghc980X nixpkgs) (ghc99X nixpkgs)])
104-
|| (system == "aarch64-darwin" && builtins.elem compiler-nix-name ["ghc8107" "ghc962" (ghc980X nixpkgs) (ghc99X nixpkgs)])
80+
&& ((system == "x86_64-linux" && !builtins.elem compiler-nix-name ["ghc884" "ghc902" "ghc928" "ghc947"])
81+
|| (system == "aarch64-linux" && !builtins.elem compiler-nix-name ["ghc884" "ghc902" "ghc928" "ghc947"])
82+
|| (system == "x86_64-darwin" && !builtins.elem compiler-nix-name ["ghc884" "ghc902" "ghc928" "ghc947"])
83+
|| (system == "aarch64-darwin" && !builtins.elem compiler-nix-name ["ghc884" "ghc902" "ghc928" "ghc947"])
10584
)) {
10685
inherit (lib.systems.examples) ghcjs;
10786
} // lib.optionalAttrs (nixpkgsName == "unstable"
108-
&& ((system == "x86_64-linux" && builtins.elem compiler-nix-name ["ghc8107" "ghc902" "ghc926" "ghc927" "ghc928" "ghc947" "ghc962" (ghc980X nixpkgs) (ghc99X nixpkgs)])
87+
&& ((system == "x86_64-linux" && !builtins.elem compiler-nix-name ["ghc884"])
10988
|| (system == "x86_64-darwin" && builtins.elem compiler-nix-name []))) { # TODO add ghc versions when we have more darwin build capacity
11089
inherit (lib.systems.examples) mingwW64;
111-
} // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "unstable" && builtins.elem compiler-nix-name ["ghc8107" "ghc902" "ghc922" "ghc923" "ghc924" "ghc926" "ghc927" "ghc928" "ghc947" "ghc962" (ghc980X nixpkgs) (ghc99X nixpkgs)]) {
90+
} // lib.optionalAttrs (nixpkgsName == "unstable"
91+
&& ((system == "x86_64-linux" && !builtins.elem compiler-nix-name ["ghc884" "ghc8107" "ghc902" "ghc928"])
92+
|| (system == "x86_64-darwin" && builtins.elem compiler-nix-name []))) { # TODO add ghc versions when we have more darwin build capacity
93+
inherit (lib.systems.examples) ucrt64;
94+
} // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "unstable" && !builtins.elem compiler-nix-name ["ghc884"]) {
11295
# Musl cross only works on linux
11396
# aarch64 cross only works on linux
11497
inherit (lib.systems.examples) musl64 aarch64-multiplatform;
11598
} // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "unstable" && builtins.elem compiler-nix-name ["ghc927" "ghc928"]) {
11699
# TODO fix this for the compilers we build with hadrian (ghc >=9.4)
117100
inherit (lib.systems.examples) aarch64-multiplatform-musl;
118-
} // lib.optionalAttrs (system == "aarch64-linux" && nixpkgsName == "unstable" && builtins.elem compiler-nix-name ["ghc927" "ghc928" "ghc947" "ghc962" (ghc980X nixpkgs) (ghc99X nixpkgs)]) {
101+
} // lib.optionalAttrs (system == "aarch64-linux" && nixpkgsName == "unstable" && !builtins.elem compiler-nix-name ["ghc884" "ghc8107" "ghc902"]) {
119102
inherit (lib.systems.examples) aarch64-multiplatform-musl;
120103
};
121104
isDisabled = d: d.meta.disabled or false;
@@ -134,7 +117,7 @@ dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: pinnedNixpkgsSrc:
134117
ghc = pkgs.buildPackages.haskell-nix.compiler.${compiler-nix-name};
135118
} // pkgs.lib.optionalAttrs runTests {
136119
inherit (build) tests tools maintainer-scripts maintainer-script-cache;
137-
} // pkgs.lib.optionalAttrs (ifdLevel >= 1) {
120+
} // pkgs.lib.optionalAttrs (ifdLevel >= 2) {
138121
inherit (pkgs.haskell-nix.iserv-proxy-exes.${compiler-nix-name}) iserv-proxy;
139122
} // pkgs.lib.optionalAttrs (ifdLevel >= 3) {
140123
hello = (pkgs.haskell-nix.hackage-package { name = "hello"; version = "1.0.0.2"; inherit evalPackages compiler-nix-name; }).getComponent "exe:hello";
@@ -152,8 +135,7 @@ dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: pinnedNixpkgsSrc:
152135
# ghc = pkgs.haskell-nix.compiler.${compiler-nix-name};
153136
# TODO: look into making tools work when cross compiling
154137
# inherit (build) tools;
155-
} // pkgs.lib.optionalAttrs (runTests && crossSystemName != "aarch64-multiplatform") {
156-
# Tests are broken on aarch64 cross https://github.com/input-output-hk/haskell.nix/issues/513
138+
} // pkgs.lib.optionalAttrs runTests {
157139
inherit (build) tests;
158140
})
159141
# GHCJS builds its own template haskell runner.

compiler/ghc/default.nix

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,14 @@ let
242242

243243
hadrian =
244244
let
245-
compiler-nix-name = if buildPackages.haskell.compiler ? "ghc928"
246-
then "ghc928"
247-
else "ghc8107";
248-
in buildPackages.pinned-haskell-nix.tool compiler-nix-name "hadrian" {
245+
compiler-nix-name =
246+
if builtins.compareVersions ghc-version "9.4.7" < 0
247+
then "ghc928"
248+
else "ghc962";
249+
in
250+
assert (buildPackages.haskell.compiler ? ${compiler-nix-name}
251+
|| throw "Expected pkgs.haskell.compiler.${compiler-nix-name} for building hadrian");
252+
buildPackages.pinned-haskell-nix.tool compiler-nix-name "hadrian" {
249253
compilerSelection = p: p.haskell.compiler;
250254
index-state = buildPackages.haskell-nix.internalHackageIndexState;
251255
# Verions of hadrian that comes with 9.6 depends on `time`
@@ -436,9 +440,11 @@ stdenv.mkDerivation (rec {
436440
done
437441
'' + lib.optionalString (src-spec.version != ghc-version) ''
438442
substituteInPlace configure --replace 'RELEASE=YES' 'RELEASE=NO'
443+
substituteInPlace configure.ac --replace 'RELEASE=YES' 'RELEASE=NO'
439444
echo '${ghc-version}' > VERSION
440445
'' + lib.optionalString (ghc-version-date != null) ''
441446
substituteInPlace configure --replace 'RELEASE=YES' 'RELEASE=NO'
447+
substituteInPlace configure.ac --replace 'RELEASE=YES' 'RELEASE=NO'
442448
echo '${ghc-version-date}' > VERSION_DATE
443449
'' + lib.optionalString (ghc-commit-id != null) ''
444450
echo '${ghc-commit-id}' > GIT_COMMIT_ID
@@ -486,7 +492,8 @@ stdenv.mkDerivation (rec {
486492

487493
hardeningDisable = [ "format" ]
488494
++ lib.optional stdenv.targetPlatform.isAarch32 "pic"
489-
++ lib.optional stdenv.targetPlatform.isMusl "pie";
495+
++ lib.optional stdenv.targetPlatform.isMusl "pie"
496+
++ lib.optional enableDWARF "fortify";
490497

491498
postInstall = lib.optionalString (enableNUMA && targetPlatform.isLinux) ''
492499
# Patch rts.conf to ensure libnuma can be found

0 commit comments

Comments
 (0)