Skip to content

Commit e5f82a3

Browse files
committed
Merge remote-tracking branch 'origin/master' into hkm/th-orphans-issue
2 parents 8666492 + c2070f0 commit e5f82a3

File tree

129 files changed

+18907
-1234
lines changed

Some content is hidden

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

129 files changed

+18907
-1234
lines changed

.github/workflows/pipeline.yml

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -139,49 +139,40 @@ jobs:
139139

140140
hydra-ifdLevel-0-and-1:
141141
runs-on: [self-hosted, linux]
142+
timeout-minutes: 20
142143
steps:
143144
- uses: actions/checkout@v4
144145
- name: "Check that jobset will evaluate in Hydra at ifdLevel 0 and 1"
145146
run: |
146147
nix-build build.nix -A maintainer-scripts.check-hydra -o check-hydra.sh
147-
./check-hydra.sh --arg ifdLevel 0
148-
./check-hydra.sh --arg ifdLevel 1
148+
sed -i 's/runningHydraEvalTest = false;/runningHydraEvalTest = true;/' flake.nix
149+
sed -i 's/ifdLevel = 3;/ifdLevel = 0;/' flake.nix
150+
./check-hydra.sh
151+
sed -i 's/ifdLevel = 0;/ifdLevel = 1;/' flake.nix
152+
./check-hydra.sh
149153
150154
hydra-ifdLevel-2:
151155
runs-on: [self-hosted, linux]
156+
timeout-minutes: 20
152157
steps:
153158
- uses: actions/checkout@v4
154159
- name: "Check that jobset will evaluate in Hydra at ifdLevel 2"
155160
run: |
156161
nix-build build.nix -A maintainer-scripts.check-hydra -o check-hydra.sh
157-
./check-hydra.sh --arg ifdLevel 2
162+
sed -i 's/runningHydraEvalTest = false;/runningHydraEvalTest = true;/' flake.nix
163+
sed -i 's/ifdLevel = 3;/ifdLevel = 2;/' flake.nix
164+
./check-hydra.sh
158165
159-
hydra-ifdLevel-3-and-ghc-8-10:
166+
hydra-ifdLevel-3:
160167
runs-on: [self-hosted, linux]
168+
timeout-minutes: 30
161169
steps:
162170
- uses: actions/checkout@v4
163-
- name: "Check that jobset will evaluate in Hydra at ifdLevel 3 and ghc 8.10"
171+
- name: "Check that jobset will evaluate in Hydra at ifdLevel 3"
164172
run: |
165173
nix-build build.nix -A maintainer-scripts.check-hydra -o check-hydra.sh
166-
./check-hydra.sh --arg ifdLevel 3 --arg include 'x: __substring 0 6 x == "ghc810"'
167-
168-
hydra-ifdLevel-3-and-ghc-9-2:
169-
runs-on: [self-hosted, linux]
170-
steps:
171-
- uses: actions/checkout@v4
172-
- name: "Check that jobset will evaluate in Hydra at ifdLevel 3 and ghc 9.2"
173-
run: |
174-
nix-build build.nix -A maintainer-scripts.check-hydra -o check-hydra.sh
175-
./check-hydra.sh --arg ifdLevel 3 --arg include 'x: __substring 0 5 x == "ghc92"'
176-
177-
hydra-ifdLevel-3-and-not-ghc-8-10-or-9-2:
178-
runs-on: [self-hosted, linux]
179-
steps:
180-
- uses: actions/checkout@v4
181-
- name: "Check that jobset will evaluate in Hydra at ifdLevel 3 and not (ghc 8.10 or ghc 9.2)"
182-
run: |
183-
nix-build build.nix -A maintainer-scripts.check-hydra -o check-hydra.sh
184-
./check-hydra.sh --arg ifdLevel 3 --arg include 'x: !(__substring 0 6 x == "ghc810" || __substring 0 5 x == "ghc92")'
174+
sed -i 's/runningHydraEvalTest = false;/runningHydraEvalTest = true;/' flake.nix
175+
./check-hydra.sh
185176
186177
closure-size:
187178
runs-on: [self-hosted, linux]

builder/comp-builder.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ let self =
2828
# (not just the one we are building).
2929
# Enable for tests in packages that use cabal-doctest.
3030
( haskellLib.isTest componentId &&
31-
lib.any (x: x.identifier.name or "" == "cabal-doctest") package.setup-depends
31+
lib.any (x: x.identifier.name or "" == "cabal-doctest") (package.setup-depends ++ setup.config.depends or [])
3232
)
3333
, allComponent # Used when `configureAllComponents` is set to get a suitable configuration.
3434

builder/ghc-for-component-wrapper.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ let
126126
127127
''
128128
+ lib.optionalString (stdenv.targetPlatform.isMusl && !haskellLib.isNativeMusl && builtins.compareVersions ghc.version "9.9" >0) ''
129+
ln -s $wrappedGhc/bin/${targetPrefix}unlit $wrappedGhc/bin/unlit
129130
ln -s $wrappedGhc/bin/${ghcCommand}-iserv $wrappedGhc/bin/ghc-iserv
130131
ln -s $wrappedGhc/bin/${ghcCommand}-iserv-prof $wrappedGhc/bin/ghc-iserv-prof
131132
''

builder/make-config-files.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
let
66
# Sort and remove duplicates from nonReinstallablePkgs.
77
# That way changes to the order of nonReinstallablePkgs does not require rebuilds.
8-
nonReinstallablePkgs' = __attrNames (lib.genAttrs nonReinstallablePkgs (x: x));
8+
nonReinstallablePkgs' = __attrNames (lib.genAttrs (component.pre-existing or [] ++ nonReinstallablePkgs) (x: x));
99

1010
ghc = if enableDWARF then defaults.ghc.dwarf else defaults.ghc;
1111

builder/shell-for.nix

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ let
6868
selectedComponents =
6969
lib.filter isSelectedComponent (lib.attrValues transitiveDependenciesComponents);
7070

71-
allHsPkgsComponents = lib.concatMap haskellLib.getAllComponents (builtins.attrValues hsPkgs);
71+
allHsPkgsComponents = lib.concatMap haskellLib.getAllComponents
72+
(lib.filter (x: !(x.isRedirect or false)) (builtins.attrValues hsPkgs));
7273

7374
# Given a list of `depends`, removes those which are selected components
7475
removeSelectedInputs =
@@ -114,9 +115,10 @@ let
114115
# Set up a "dummy" component to use with ghcForComponent.
115116
component = {
116117
depends = packageInputs;
117-
libs = [];
118-
pkgconfig = [];
119-
frameworks = [];
118+
pre-existing = lib.concatMap (x: (haskellLib.dependToLib x).config.pre-existing or []) packageInputs;
119+
libs = lib.concatMap (x: (haskellLib.dependToLib x).config.libs or []) packageInputs;
120+
pkgconfig = lib.concatMap (x: (haskellLib.dependToLib x).config.pkgconfig or []) packageInputs;
121+
frameworks = lib.concatMap (x: (haskellLib.dependToLib x).config.frameworks or []) packageInputs;
120122
doExactConfig = false;
121123
};
122124
configFiles = makeConfigFiles {

changelog.md

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

4+
## Sep 17, 2024
5+
6+
Cabal projects now use the more granular Unit IDs from plan.json
7+
to identify packages. This allows for different versions of a
8+
package to be used when building `built-tool-depends` and setup
9+
dependencies.
10+
11+
Overrides in the `modules` argument apply to all versions of
12+
the package. However to make this work we needed to make
13+
each `packages.somepackage` an option (instead of using an
14+
`attrsOf` the submodule type).
15+
16+
It is now an error to override a package that is not in the
17+
plan. This can be a problem if different GHC versions, target
18+
platforms, or cabal flag settings cause the package to be
19+
excluded from the plan. Adding `package-keys` can tell
20+
haskell.nix to include the option anyway:
21+
22+
```
23+
modules = [{
24+
# Tell haskell.nix that `somepackage` may exist.
25+
package-keys = ["somepackage"];
26+
# Now the following will not cause an error even
27+
# if `somepackage` is not in the plan
28+
packages.somepackage.flags.someflag = true;
29+
}];
30+
```
31+
32+
There is a helper function you can use to add `package-keys`
33+
for all of the `builtins.attrNames` of `packages`:
34+
35+
```
36+
modules = [(pkgs.haskell-nix.haskellLib.addPackageKeys {
37+
packages.somepackage.flags.someflag = true;
38+
})];
39+
```
40+
41+
Do not use the module's `pkgs` arg to look `addPackageKeys` up
42+
though or it will result an `infinite recursion` error.
43+
44+
Code that uses `options.packages` will also need to be updated.
45+
For instance the following code that uses `options.packages`
46+
to set `--Werror` for local packages:
47+
48+
```
49+
({ lib, ... }: {
50+
options.packages = lib.mkOption {
51+
type = lib.types.attrsOf (lib.types.submodule (
52+
{ config, lib, ... }:
53+
lib.mkIf config.package.isLocal
54+
{
55+
configureFlags = [ "--ghc-option=-Werror"];
56+
}
57+
));
58+
};
59+
})
60+
```
61+
62+
Now needs to do it for each of the entry in `config.package-keys`
63+
instead of using `attrsOf`:
64+
65+
```
66+
({ config, lib, ... }: {
67+
options.packages = lib.genAttrs config.package-keys (_:
68+
lib.mkOption {
69+
type = lib.types.submodule (
70+
{ config, lib, ... }:
71+
lib.mkIf config.package.isLocal
72+
{
73+
configureFlags = [ "--ghc-option=-Werror"];
74+
}
75+
);
76+
});
77+
})
78+
```
79+
480
## Jun 5, 2024
581

682
Haskell.nix now respects the `pre-existing` packages selected

ci.nix

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,17 @@
6262
# from here (so that is no longer cached) also remove ./materialized/ghcXXX.
6363
# Update supported-ghc-versions.md to reflect any changes made here.
6464
nixpkgs.lib.optionalAttrs (nixpkgsName == "R2405") {
65-
ghc94 = false;
6665
ghc96 = false;
6766
ghc98 = false;
6867
} // nixpkgs.lib.optionalAttrs (nixpkgsName == "unstable") {
6968
ghc810 = true;
70-
ghc90 = false;
71-
ghc92 = true;
72-
ghc94 = true;
69+
ghc92 = false;
70+
ghc94 = false;
7371
ghc96 = true;
74-
ghc96llvm = true;
7572
ghc98 = true;
76-
ghc98llvm = true;
73+
ghc98llvm = false;
7774
ghc910 = true;
75+
ghc910llvm = true;
7876
ghc911 = true;
7977
})));
8078
crossSystems = nixpkgsName: nixpkgs: compiler-nix-name:
@@ -85,21 +83,21 @@
8583
&& (__match ".*llvm" compiler-nix-name == null)
8684
&& ((system == "x86_64-linux" && !builtins.elem compiler-nix-name ["ghc884" "ghc902" "ghc928" "ghc948"])
8785
|| (system == "aarch64-linux" && !builtins.elem compiler-nix-name ["ghc884" "ghc902" "ghc928" "ghc948"])
88-
|| (system == "x86_64-darwin" && !builtins.elem compiler-nix-name ["ghc884" "ghc902" "ghc928" "ghc948"])
89-
|| (system == "aarch64-darwin" && !builtins.elem compiler-nix-name ["ghc884" "ghc902" "ghc928" "ghc948"])
86+
|| (system == "x86_64-darwin" && !builtins.elem compiler-nix-name ["ghc884" "ghc902" "ghc928" "ghc948" "ghc966" "ghc982"])
87+
|| (system == "aarch64-darwin" && !builtins.elem compiler-nix-name ["ghc884" "ghc902" "ghc928" "ghc948" "ghc966" "ghc982"])
9088
)) {
9189
inherit (lib.systems.examples) ghcjs;
9290
} // lib.optionalAttrs (
9391
(__match ".*llvm" compiler-nix-name == null)
94-
&& ((system == "x86_64-linux" && !builtins.elem compiler-nix-name ["ghc884" "ghc91120240620"]) # Including GHC HEAD here because the patches for rts/RtsSymbols.c no longer apply and mingwW64 GHC build fails without them
92+
&& ((system == "x86_64-linux" && !builtins.elem compiler-nix-name ["ghc884" "ghc902" "ghc928" "ghc91120240918"]) # Including GHC HEAD here because the patches for rts/RtsSymbols.c no longer apply and mingwW64 GHC build fails without them
9593
|| (system == "x86_64-darwin" && builtins.elem compiler-nix-name []))) { # TODO add ghc versions when we have more darwin build capacity
9694
inherit (lib.systems.examples) mingwW64;
9795
} // lib.optionalAttrs (nixpkgsName == "unstable"
9896
&& (__match ".*llvm" compiler-nix-name == null)
99-
&& ((system == "x86_64-linux" && !builtins.elem compiler-nix-name ["ghc884" "ghc8107" "ghc902" "ghc928"])
97+
&& ((system == "x86_64-linux" && !builtins.elem compiler-nix-name ["ghc884" "ghc8107" "ghc902" "ghc928" "ghc948"])
10098
|| (system == "x86_64-darwin" && builtins.elem compiler-nix-name []))) { # TODO add ghc versions when we have more darwin build capacity
10199
inherit (lib.systems.examples) ucrt64;
102-
} // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "unstable" && !builtins.elem compiler-nix-name ["ghc884"]) {
100+
} // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "unstable" && !builtins.elem compiler-nix-name ["ghc884" "ghc902" "ghc928" "ghc948"]) {
103101
# Musl cross only works on linux
104102
# aarch64 cross only works on linux
105103
inherit (lib.systems.examples) musl64 aarch64-multiplatform;

compiler/ghc/default.nix

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ let
232232
if targetPlatform.isGhcjs
233233
then [ buildPackages.emscripten ]
234234
else if hostPlatform == buildPlatform
235-
then [ targetPackages.stdenv.cc ] ++ lib.optional useLLVM llvmPackages.llvm
235+
then [ targetPackages.stdenv.cc ] ++ lib.optionals useLLVM [llvmPackages.llvm llvmPackages.clang]
236236
else assert targetPlatform == hostPlatform; # build != host == target
237237
[ stdenv.cc ] ++ lib.optional useLLVM buildLlvmPackages.llvm;
238238

@@ -362,14 +362,8 @@ let
362362
# Sometimes we have to dispatch between the bintools wrapper and the unwrapped
363363
# derivation for certain tools depending on the platform.
364364
bintoolsFor = {
365-
# GHC needs install_name_tool on all darwin platforms. On aarch64-darwin it is
366-
# part of the bintools wrapper (due to codesigning requirements), but not on
367-
# x86_64-darwin.
368-
install_name_tool =
369-
if stdenv.targetPlatform.isAarch64
370-
then targetCC.bintools
371-
else targetCC.bintools.bintools;
372-
# Same goes for strip.
365+
# GHC needs install_name_tool on all darwin platforms.
366+
install_name_tool = targetCC.bintools.bintools;
373367
strip =
374368
# TODO(@sternenseemann): also use wrapper if linker == "bfd" or "gold"
375369
if stdenv.targetPlatform.isAarch64
@@ -403,14 +397,26 @@ stdenv.mkDerivation (rec {
403397
done
404398
''
405399
# Use emscripten and the `config.sub` saved by `postPatch`
406-
+ lib.optionalString (targetPlatform.isGhcjs) ''
400+
+ lib.optionalString (targetPlatform.isGhcjs) (''
407401
export CC="${targetCC}/bin/emcc"
408402
export CXX="${targetCC}/bin/em++"
409403
export LD="${targetCC}/bin/emcc"
410-
export NM="${targetCC}/share/emscripten/emnm"
404+
'' + (
405+
# Including AR and RANLIB here breaks tests.js-template-haskell for GHC 9.6
406+
# `LLVM ERROR: malformed uleb128, extends past end`
407+
if builtins.compareVersions ghc-version "9.8" >= 0
408+
then ''
409+
export AR="${targetCC}/bin/emar"
410+
export NM="${targetCC}/share/emscripten/emnm"
411+
export RANLIB="${targetCC}/bin/emranlib"
412+
''
413+
else ''
414+
export NM="${targetCC}/share/emscripten/emnm"
415+
''
416+
) + ''
411417
export EM_CACHE=$(mktemp -d)
412418
mv config.sub.ghcjs config.sub
413-
''
419+
'')
414420
# GHC is a bit confused on its cross terminology, as these would normally be
415421
# the *host* tools.
416422
+ lib.optionalString (!targetPlatform.isGhcjs) (''
@@ -744,7 +750,7 @@ stdenv.mkDerivation (rec {
744750
} // extra-passthru;
745751

746752
meta = {
747-
homepage = http://haskell.org/ghc;
753+
homepage = "https://haskell.org/ghc";
748754
description = "The Glasgow Haskell Compiler";
749755
maintainers = [];
750756
inherit (ghc.meta) license platforms;

flake.lock

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)