Skip to content

Commit 5b61481

Browse files
committed
Merge branch 'master' of github.com:input-output-hk/haskell.nix into circuithub
2 parents da0b436 + 9261dd9 commit 5b61481

File tree

357 files changed

+28206
-1721
lines changed

Some content is hidden

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

357 files changed

+28206
-1721
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]

build.nix

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ in rec {
2828
pkgs.recurseIntoAttrs ({
2929
cabal-latest = tool compiler-nix-name "cabal" ({
3030
inherit evalPackages;
31-
} // pkgs.lib.optionalAttrs (ghcFromTo "9.10" "9.12") {
31+
} // pkgs.lib.optionalAttrs (ghcFromTo "9.13" "9.14") {
3232
cabalProjectLocal = builtins.readFile ./test/cabal.project.local;
3333
});
3434
} // pkgs.lib.optionalAttrs (__compareVersions haskell.compiler.${compiler-nix-name}.version "9.8" < 0) {
@@ -62,7 +62,7 @@ in rec {
6262
inherit evalPackages;
6363
src = pkgs.haskell-nix.sources."hls-2.2";
6464
};
65-
} // pkgs.lib.optionalAttrs (ghcFromTo "9.0" "9.11") {
65+
} // pkgs.lib.optionalAttrs (ghcFromTo "9.0" "9.8.3" || ghcFromTo "9.10" "9.11") {
6666
"hls-29" = tool compiler-nix-name "haskell-language-server" {
6767
inherit evalPackages;
6868
src = pkgs.haskell-nix.sources."hls-2.9";
@@ -77,14 +77,14 @@ in rec {
7777
maintainer-scripts = pkgs.dontRecurseIntoAttrs {
7878
update-hackage = import ./scripts/update-hackage.nix {
7979
inherit (pkgs) stdenv lib writeScript coreutils glibc git
80-
openssh nixFlakes gawk bash curl findutils;
80+
openssh nixVersions gawk bash curl findutils;
8181
# Update scripts use the internal nix-tools (compiled with a fixed GHC version)
8282
nix-tools = haskell.nix-tools-unchecked;
8383
inherit (haskell) update-index-state-hashes cabal-issue-8352-workaround;
8484
};
8585
update-stackage = haskell.callPackage ./scripts/update-stackage.nix {
8686
inherit (pkgs) stdenv lib writeScript coreutils glibc git
87-
openssh nixFlakes gawk bash curl findutils;
87+
openssh nixVersions gawk bash curl findutils;
8888
# Update scripts use the internal nix-tools (compiled with a fixed GHC version)
8989
nix-tools = haskell.nix-tools-unchecked;
9090
inherit (haskell) cabal-issue-8352-workaround;

builder/comp-builder.nix

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ 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 &&
32-
lib.any (x: x.identifier.name or "" == "doctest") component.depends
31+
lib.any (x: x.identifier.name or "" == "cabal-doctest") (package.setup-depends ++ setup.config.depends or []) &&
32+
lib.any (x: x.identifier.name or "" == "doctest") (package.setup-depends ++ setup.config.depends or [])
3333
)
3434
, allComponent # Used when `configureAllComponents` is set to get a suitable configuration.
3535

@@ -198,6 +198,9 @@ let
198198
"--with-gcc=${pkgsBuildBuild.emscripten}/bin/emcc"
199199
"--with-ld=${pkgsBuildBuild.emscripten}/bin/emcc"
200200
]
201+
++ lib.optionals (stdenv.hostPlatform.isGhcjs && stdenv.buildPlatform.isDarwin) [
202+
"--ar-options=--format=gnu" # Avoid `--format=darwin` it can cause `section too large` errors
203+
]
201204
++ [ # other flags
202205
(disableFeature dontStrip "executable-stripping")
203206
(disableFeature dontStrip "library-stripping")

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: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{ lib, stdenv, mkShell, glibcLocales, pkgconfig, ghcForComponent, makeConfigFiles, hsPkgs, hoogleLocal, haskellLib, pkgsBuildBuild, evalPackages, compiler }:
1+
{ lib, stdenv, mkShell, glibcLocales, ghcForComponent, makeConfigFiles, hsPkgs, hoogleLocal, haskellLib, pkgsBuildBuild, evalPackages, compiler }:
22

33
{ # `packages` function selects packages that will be worked on in the shell itself.
44
# These packages will not be built by `shellFor`, but their
@@ -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: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -62,51 +62,51 @@
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;
78-
ghc911 = true;
75+
ghc910llvm = true;
76+
ghc9121 = true;
77+
ghc912X = true;
78+
ghc913 = true;
7979
})));
8080
crossSystems = nixpkgsName: nixpkgs: compiler-nix-name:
8181
# We need to use the actual nixpkgs version we're working with here, since the values
8282
# of 'lib.systems.examples' are not understood between all versions
8383
let lib = nixpkgs.lib;
8484
in lib.optionalAttrs (nixpkgsName == "unstable"
8585
&& (__match ".*llvm" compiler-nix-name == null)
86-
&& ((system == "x86_64-linux" && !builtins.elem compiler-nix-name ["ghc884" "ghc902" "ghc928" "ghc948"])
87-
|| (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-linux" && !builtins.elem compiler-nix-name ["ghc902" "ghc928" "ghc948"])
87+
|| (system == "aarch64-linux" && !builtins.elem compiler-nix-name ["ghc902" "ghc928" "ghc948"])
88+
|| (system == "x86_64-darwin" && !builtins.elem compiler-nix-name ["ghc902" "ghc928" "ghc948" "ghc966" "ghc982" "ghc983" "ghc984"])
89+
|| (system == "aarch64-darwin" && !builtins.elem compiler-nix-name ["ghc902" "ghc928" "ghc948" "ghc966" "ghc982" "ghc983" "ghc984"])
9090
)) {
9191
inherit (lib.systems.examples) ghcjs;
9292
} // lib.optionalAttrs (
9393
(__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
94+
&& ((system == "x86_64-linux" && !builtins.elem compiler-nix-name ["ghc902" "ghc928"]) # Including GHC HEAD here because the patches for rts/RtsSymbols.c no longer apply and mingwW64 GHC build fails without them
9595
|| (system == "x86_64-darwin" && builtins.elem compiler-nix-name []))) { # TODO add ghc versions when we have more darwin build capacity
9696
inherit (lib.systems.examples) mingwW64;
9797
} // lib.optionalAttrs (nixpkgsName == "unstable"
9898
&& (__match ".*llvm" compiler-nix-name == null)
99-
&& ((system == "x86_64-linux" && !builtins.elem compiler-nix-name ["ghc884" "ghc8107" "ghc902" "ghc928"])
99+
&& ((system == "x86_64-linux" && !builtins.elem compiler-nix-name ["ghc8107" "ghc902" "ghc928" "ghc948"])
100100
|| (system == "x86_64-darwin" && builtins.elem compiler-nix-name []))) { # TODO add ghc versions when we have more darwin build capacity
101101
inherit (lib.systems.examples) ucrt64;
102-
} // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "unstable" && !builtins.elem compiler-nix-name ["ghc884"]) {
102+
} // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "unstable" && !builtins.elem compiler-nix-name ["ghc902" "ghc928" "ghc948"]) {
103103
# Musl cross only works on linux
104104
# aarch64 cross only works on linux
105105
inherit (lib.systems.examples) musl64 aarch64-multiplatform;
106106
} // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "unstable" && builtins.elem compiler-nix-name ["ghc927" "ghc928"]) {
107107
# TODO fix this for the compilers we build with hadrian (ghc >=9.4)
108108
inherit (lib.systems.examples) aarch64-multiplatform-musl;
109-
} // lib.optionalAttrs (system == "aarch64-linux" && nixpkgsName == "unstable" && !builtins.elem compiler-nix-name ["ghc884" "ghc8107" "ghc902"]) {
109+
} // lib.optionalAttrs (system == "aarch64-linux" && nixpkgsName == "unstable" && !builtins.elem compiler-nix-name ["ghc8107" "ghc902"]) {
110110
inherit (lib.systems.examples) aarch64-multiplatform-musl;
111111
};
112112
isDisabled = d: d.meta.disabled or false;

0 commit comments

Comments
 (0)