Skip to content

Commit 6b3b2b2

Browse files
committed
Merge remote-tracking branch 'origin/master' into hkm/wasm
# Conflicts: # ci.nix # compiler/ghc/default.nix # flake.lock # test/cabal.project.local # test/th-dlls/default.nix
2 parents 866b410 + 7fdfec7 commit 6b3b2b2

Some content is hidden

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

43 files changed

+783
-236
lines changed

.github/workflows/pipeline.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,18 @@ jobs:
223223
steps:
224224
- uses: actions/checkout@v4
225225
- name: "Check that evaluation of hydra jobs works without using remote builders for GHC 9.6.7"
226-
run: nix path-info --derivation .#requiredJobs.x86_64-darwin.required-unstable-ghc967-native --show-trace --builders ''
226+
run: |
227+
sed -i 's/runningHydraEvalTest = true;/runningHydraEvalTest = false;/' flake.nix
228+
nix path-info --derivation .#requiredJobs.x86_64-darwin.required-unstable-ghc967-native --show-trace --builders ''
227229
228230
hydra-without-remote-builders-ghc9102:
229231
runs-on: [self-hosted, linux]
230232
steps:
231233
- uses: actions/checkout@v4
232234
- name: "Check that evaluation of hydra jobs works without using remote builders for GHC 9.10.2"
233-
run: nix path-info --derivation .#requiredJobs.x86_64-darwin.required-unstable-ghc9102-native --show-trace --builders ''
235+
run: |
236+
sed -i 's/runningHydraEvalTest = true;/runningHydraEvalTest = false;/' flake.nix
237+
nix path-info --derivation .#requiredJobs.x86_64-darwin.required-unstable-ghc9102-native --show-trace --builders ''
234238
235239
hix-cabal:
236240
runs-on: [self-hosted, linux]

builder/comp-builder.nix

Lines changed: 140 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
{ pkgs, stdenv, buildPackages, pkgsBuildBuild, ghc, llvmPackages, lib, gobject-introspection ? null, haskellLib, makeConfigFiles, haddockBuilder, ghcForComponent, hsPkgs, compiler, runCommand, libffi, gmp, windows, zlib, ncurses, nodejs, nonReinstallablePkgs }@defaults:
2-
lib.makeOverridable (
3-
let self =
42
{ componentId
53
, component
64
, package
@@ -92,7 +90,76 @@ let self =
9290
# LLVM
9391
, useLLVM ? ghc.useLLVM or false
9492
, smallAddressSpace ? false
95-
93+
}:
94+
# makeOverridable is called here after all the `? DEFAULT` arguments
95+
# will have been applied. This makes sure that `c.override (oldAttrs: {...})`
96+
# includes these `DEFAULT` values in `oldAttrs`. This is important
97+
# so that overrides can modify the existing values instead of replacing them.
98+
lib.makeOverridable (
99+
let self =
100+
{ componentId
101+
, component
102+
, package
103+
, name
104+
, setup
105+
, src
106+
, flags
107+
, cabalFile
108+
, cabal-generator
109+
, patches
110+
, preUnpack
111+
, configureFlags
112+
, prePatch
113+
, postPatch
114+
, preConfigure
115+
, postConfigure
116+
, setupBuildFlags
117+
, preBuild
118+
, postBuild
119+
, preCheck
120+
, postCheck
121+
, setupInstallFlags
122+
, preInstall
123+
, postInstall
124+
, preHaddock
125+
, postHaddock
126+
, shellHook
127+
, configureAllComponents
128+
, allComponent
129+
, build-tools
130+
, pkgconfig
131+
, platforms
132+
, frameworks
133+
, dontPatchELF
134+
, dontStrip
135+
, dontUpdateAutotoolsGnuConfigScripts
136+
, hardeningDisable
137+
, enableStatic
138+
, enableShared
139+
, enableExecutableDynamic
140+
, enableDeadCodeElimination
141+
, writeHieFiles
142+
, ghcOptions
143+
, contentAddressed
144+
, doHaddock
145+
, doHoogle
146+
, hyperlinkSource
147+
, quickjump
148+
, keepConfigFiles
149+
, keepGhc
150+
, keepSource
151+
, setupHaddockFlags
152+
, enableLibraryProfiling
153+
, enableProfiling
154+
, profilingDetail
155+
, doCoverage
156+
, enableSeparateDataOutput
157+
, enableLibraryForGhci
158+
, enableDebugRTS
159+
, enableDWARF
160+
, enableTSanRTS
161+
, useLLVM
162+
, smallAddressSpace
96163
}@drvArgs:
97164

98165
let
@@ -341,7 +408,7 @@ let
341408
}
342409
// lib.optionalAttrs stdenv.hostPlatform.isMusl {
343410
# This fixes musl compilation of TH code that depends on C++ (for instance TH code that uses the double-conversion package)
344-
LD_LIBRARY_PATH="${pkgs.buildPackages.gcc-unwrapped.lib}/x86_64-unknown-linux-musl/lib";
411+
LD_LIBRARY_PATH="${pkgs.buildPackages.gcc-unwrapped.lib}/${stdenv.hostPlatform.config}/lib";
345412
}
346413
// lib.optionalAttrs dontUpdateAutotoolsGnuConfigScripts {
347414
inherit dontUpdateAutotoolsGnuConfigScripts;
@@ -655,6 +722,10 @@ let
655722
mkdir -p $out/share
656723
if [ -d dist/build/extra-compilation-artifacts ]; then
657724
cp -r dist/build/extra-compilation-artifacts/hpc $out/share
725+
elif [ -d ${testExecutable}-tmp/extra-compilation-artifacts ]; then
726+
cp -r ${testExecutable}-tmp/extra-compilation-artifacts/hpc $out/share
727+
elif [ -d dist/build/${componentId.cname}/extra-compilation-artifacts ]; then
728+
cp -r dist/build/${componentId.cname}/extra-compilation-artifacts/hpc $out/share
658729
else
659730
cp -r dist/hpc $out/share
660731
fi
@@ -718,4 +789,68 @@ let
718789
// lib.optionalAttrs (hardeningDisable != [] || stdenv.hostPlatform.isMusl) {
719790
hardeningDisable = hardeningDisable ++ lib.optional stdenv.hostPlatform.isMusl "pie";
720791
});
721-
in drv; in self)
792+
in drv; in self) {
793+
inherit componentId
794+
component
795+
package
796+
name
797+
setup
798+
src
799+
flags
800+
cabalFile
801+
cabal-generator
802+
patches
803+
preUnpack
804+
configureFlags
805+
prePatch
806+
postPatch
807+
preConfigure
808+
postConfigure
809+
setupBuildFlags
810+
preBuild
811+
postBuild
812+
preCheck
813+
postCheck
814+
setupInstallFlags
815+
preInstall
816+
postInstall
817+
preHaddock
818+
postHaddock
819+
shellHook
820+
configureAllComponents
821+
allComponent
822+
build-tools
823+
pkgconfig
824+
platforms
825+
frameworks
826+
dontPatchELF
827+
dontStrip
828+
dontUpdateAutotoolsGnuConfigScripts
829+
hardeningDisable
830+
enableStatic
831+
enableShared
832+
enableExecutableDynamic
833+
enableDeadCodeElimination
834+
writeHieFiles
835+
ghcOptions
836+
contentAddressed
837+
doHaddock
838+
doHoogle
839+
hyperlinkSource
840+
quickjump
841+
keepConfigFiles
842+
keepGhc
843+
keepSource
844+
setupHaddockFlags
845+
enableLibraryProfiling
846+
enableProfiling
847+
profilingDetail
848+
doCoverage
849+
enableSeparateDataOutput
850+
enableLibraryForGhci
851+
enableDebugRTS
852+
enableDWARF
853+
enableTSanRTS
854+
useLLVM
855+
smallAddressSpace;
856+
}

builder/default.nix

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ let
2626
};
2727

2828
setup-builder = haskellLib.weakCallPackage pkgs ./setup-builder.nix {
29-
ghc = (ghc.passthru.buildGHC or ghc);
29+
ghc = (ghc.buildGHC or ghc);
3030
hsPkgs = hsPkgs.buildPackages;
3131
# We need to use the buildPackages stdenv to build the setup-builder.
3232
# in the native case, it would be the same in the cross case however
@@ -41,7 +41,7 @@ let
4141
# component builder and for nix-shells.
4242
ghcForComponent = import ./ghc-for-component-wrapper.nix {
4343
inherit lib ghc haskellLib;
44-
inherit (buildPackages) stdenv;
44+
inherit (pkgs) stdenv;
4545
inherit (buildPackages.buildPackages) runCommand makeWrapper;
4646
inherit (buildPackages.buildPackages.xorg) lndir;
4747
};
@@ -54,7 +54,7 @@ let
5454
# When building setup depends we need to use the build systems GHC and Packages
5555
makeSetupConfigFiles = haskellLib.weakCallPackage buildPackages ./make-config-files.nix {
5656
inherit haskellLib nonReinstallablePkgs;
57-
ghc = (ghc.passthru.buildGHC or ghc);
57+
ghc = (ghc.buildGHC or ghc);
5858
};
5959

6060

builder/ghc-for-component-wrapper.nix

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
, postInstall ? ""
1515
, enableDWARF
1616
, plugins
17+
, ghcOptions ? []
1718
}:
1819

1920
let
@@ -23,8 +24,9 @@ let
2324
libDir = "$wrappedGhc/${configFiles.libDir}";
2425
docDir = "$wrappedGhc/share/doc/ghc/html";
2526
# For musl we can use haddock from the buildGHC
26-
haddock = if stdenv.targetPlatform.isMusl
27-
then ghc.buildGHC
27+
haddock = if stdenv.hostPlatform.isMusl
28+
then ghc.buildGHC or ghc # `or ghc` is here because nixpkgs GHC does not have `buildGHC`
29+
# TODO find a way to get suitable GHC and/or respect `ghc.hasHaddock`.
2830
else ghc;
2931

3032
script = ''
@@ -107,7 +109,7 @@ let
107109
--set "NIX_${ghcCommandCaps}PKG" "$wrappedGhc/bin/${ghcCommand}-pkg" \
108110
--set "NIX_${ghcCommandCaps}_DOCDIR" "${docDir}" \
109111
--set "GHC_PLUGINS" "$GHC_PLUGINS" \
110-
--set "NIX_${ghcCommandCaps}_LIBDIR" "${libDir}"
112+
--set "NIX_${ghcCommandCaps}_LIBDIR" "${libDir}"${lib.concatMapStrings (o: " --add-flags ${o}") ghcOptions}
111113
fi
112114
done
113115
@@ -159,8 +161,7 @@ let
159161
inherit script targetPrefix;
160162
inherit (ghc) version meta;
161163
};
162-
propagatedBuildInputs = configFiles.libDeps;
163-
nativeBuildInputs = [ghc];
164+
propagatedBuildInputs = configFiles.libDeps ++ lib.optional stdenv.hasCC stdenv.cc ++ [ghc];
164165
} (''
165166
mkdir -p $out/configFiles
166167
configFiles=$out/configFiles

builder/shell-for.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ let
143143
'';
144144
inherit enableDWARF;
145145
plugins = [];
146+
ghcOptions = haskell-nix.templateHaskell.${compiler.nix-name}.ghcOptions or [];
146147
};
147148

148149
hoogleIndex = let
@@ -192,11 +193,16 @@ in
192193
''} $(builtin type -P "${ghcEnv.targetPrefix}pkg-config" &> /dev/null && echo "--with-pkg-config=${ghcEnv.targetPrefix}pkg-config") \
193194
"$@"
194195
'');
196+
propagatedBuildInputs = mkDrvArgs.propagateBuildInputs or [] ++ ghcEnv.drv.propagatedBuildInputs;
195197
phases = ["installPhase"];
196198
installPhase = ''
197199
echo "${"Shell for " + toString (builtins.map (p : p.identifier.name) selectedPackages)}"
198200
echo $nativeBuildInputs $buildInputs > $out
199201
'';
202+
shellHook = mkDrvArgs.shellHook or "" + lib.optionalString stdenv.hostPlatform.isWindows ''
203+
204+
export pkgsHostTargetAsString="''${pkgsHostTarget[@]}"
205+
'';
200206

201207
# This helps tools like `ghcide` (that use the ghc api) to find
202208
# the correct global package DB.

changelog.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,42 @@
11
This file contains a summary of changes to Haskell.nix and `nix-tools`
22
that will impact users.
33

4+
## Jul 3, 2025
5+
6+
Some time ago the behavior of `shellFor` changed so that the arguments
7+
are now checked against `modules/shell.nix`. This was done as part of a fix
8+
for bugs in the way `shellFor` arguments and project `shell` arguments
9+
interacted (both are now `modules` and the normal module merge rules apply).
10+
11+
This means it is no longer possible to pass arbitrarily named arguments
12+
to `shellFor` in order to set environment variables.
13+
14+
Instead of:
15+
16+
```
17+
p.shellFor {
18+
FOO = "bar";
19+
}
20+
```
21+
22+
Use:
23+
24+
```
25+
p.shellFor {
26+
shellHook = ''
27+
export FOO="bar"
28+
'';
29+
}
30+
```
31+
32+
or
33+
34+
```
35+
(p.shellFor {}).overrideAttrs {
36+
FOO = "bar";
37+
}
38+
```
39+
440
## Jan 29, 2025
541

642
Removed GHC <9.6 from CI.

0 commit comments

Comments
 (0)