Skip to content

Commit 37c7bf9

Browse files
committed
Merge branch 'master' into avieth/misc-patches
2 parents 8d63ecd + 986a65b commit 37c7bf9

File tree

206 files changed

+23633
-8780
lines changed

Some content is hidden

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

206 files changed

+23633
-8780
lines changed

.buildkite/pipeline.yml

Lines changed: 111 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,112 @@
11
steps:
2-
- label: 'Run tests with ghc8107'
3-
command: "./test/tests.sh ghc8107"
2+
- label: 'Run tests with ghc8107: Running the nix-build tests...'
3+
command: "./test/tests.sh ghc8107 nix-build"
44
agents:
55
system: x86_64-linux
66

7-
- label: 'Check that jobset will evaluate in Hydra'
7+
- label: 'Run tests with ghc8107: Running the unit tests...'
8+
command: "./test/tests.sh ghc8107 unit-tests"
9+
agents:
10+
system: x86_64-linux
11+
12+
- label: 'Run tests with ghc8107: Checking that a nix-shell works for runghc...'
13+
command: "./test/tests.sh ghc8107 runghc"
14+
agents:
15+
system: x86_64-linux
16+
17+
- label: 'Run tests with ghc8107: Checking that a nix-shell works for cabal...'
18+
command: "./test/tests.sh ghc8107 cabal"
19+
agents:
20+
system: x86_64-linux
21+
22+
- label: 'Run tests with ghc8107: Checking that a nix-shell works for cabal (doExactConfig component)...'
23+
command: "./test/tests.sh ghc8107 cabal-doExactConfig"
24+
agents:
25+
system: x86_64-linux
26+
27+
- label: 'Run tests with ghc8107: Checking that a nix-shell works for a project with test-suite build-tools and benchmarks...'
28+
command: "./test/tests.sh ghc8107 tests-benchmarks"
29+
agents:
30+
system: x86_64-linux
31+
32+
- label: 'Run tests with ghc8107: Checking that a nix-shell works for a multi-target project...'
33+
command: "./test/tests.sh ghc8107 multi-target"
34+
agents:
35+
system: x86_64-linux
36+
37+
- label: 'Run tests with ghc8107: Checking shellFor works for a cabal project, multiple packages...'
38+
command: "./test/tests.sh ghc8107 shellFor-single-package"
39+
agents:
40+
system: x86_64-linux
41+
42+
- label: 'Run tests with ghc8107: Checking shellFor works for a cabal project, single package...y'
43+
command: "./test/tests.sh ghc8107 shellFor-multiple-package"
44+
agents:
45+
system: x86_64-linux
46+
47+
- label: 'Run tests with ghc8107: Checking shellFor works for a cabal project, single package...'
48+
command: "./test/tests.sh ghc8107 shellFor-hoogle"
49+
agents:
50+
system: x86_64-linux
51+
52+
- label: 'Run tests with ghc8107: Checking shellFor does not depend on given packages...y'
53+
command: "./test/tests.sh ghc8107 shellFor-not-depends"
54+
agents:
55+
system: x86_64-linux
56+
57+
- label: 'Run tests with ghc8107: Checking the maintainer scripts...y'
58+
command: "./test/tests.sh ghc8107 maintainer-scripts"
59+
agents:
60+
system: x86_64-linux
61+
62+
- label: 'Run tests with ghc8107: Checking that plan construction works with extra Hackages...'
63+
command: "./test/tests.sh ghc8107 plan-extra-hackages"
64+
agents:
65+
system: x86_64-linux
66+
67+
- label: 'Run tests with ghc8107: Checking that package with extra Hackages can be build...'
68+
command: "./test/tests.sh ghc8107 build-extra-hackages"
69+
agents:
70+
system: x86_64-linux
71+
72+
- label: 'Run tests with ghc8107: End-2-end test of hix project initialization and flakes development shell ...'
73+
command: "./test/tests.sh ghc8107 hix"
74+
agents:
75+
system: x86_64-linux
76+
77+
- label: 'Check that jobset will evaluate in Hydra at ifdLevel 0 and 1'
878
command:
979
- nix-build build.nix -A maintainer-scripts.check-hydra -o check-hydra.sh
10-
- ./check-hydra.sh 0
11-
- ./check-hydra.sh 1
12-
- ./check-hydra.sh 2
13-
- ./check-hydra.sh 3
80+
- ./check-hydra.sh --arg ifdLevel 0
81+
- ./check-hydra.sh --arg ifdLevel 1
82+
agents:
83+
system: x86_64-linux
84+
85+
- label: 'Check that jobset will evaluate in Hydra at ifdLevel 2'
86+
command:
87+
- nix-build build.nix -A maintainer-scripts.check-hydra -o check-hydra.sh
88+
- ./check-hydra.sh --arg ifdLevel 2
89+
agents:
90+
system: x86_64-linux
91+
92+
- label: 'Check that jobset will evaluate in Hydra at ifdLevel 3 and ghc 8.10'
93+
command:
94+
- nix-build build.nix -A maintainer-scripts.check-hydra -o check-hydra.sh
95+
- "./check-hydra.sh --arg ifdLevel 3 --arg include 'x: __substring 0 6 x == \"ghc810\"'"
96+
agents:
97+
system: x86_64-linux
98+
99+
- label: 'Check that jobset will evaluate in Hydra at ifdLevel 3 and ghc 9.2'
100+
command:
101+
- nix-build build.nix -A maintainer-scripts.check-hydra -o check-hydra.sh
102+
- "./check-hydra.sh --arg ifdLevel 3 --arg include 'x: __substring 0 5 x == \"ghc92\"'"
103+
agents:
104+
system: x86_64-linux
105+
106+
- label: 'Check that jobset will evaluate in Hydra at ifdLevel 3 and not (ghc 8.10 or ghc 9.2)'
107+
command:
108+
- nix-build build.nix -A maintainer-scripts.check-hydra -o check-hydra.sh
109+
- "./check-hydra.sh --arg ifdLevel 3 --arg include 'x: !(__substring 0 6 x == \"ghc810\" || __substring 0 5 x == \"ghc92\")'"
14110
agents:
15111
system: x86_64-linux
16112

@@ -41,7 +137,7 @@ steps:
41137

42138
- label: 'Check that the haskell.nix roots do not require IFDs'
43139
command:
44-
- nix build .#roots.x86_64-linux --option allow-import-from-derivation false
140+
- nix build .#roots.x86_64-linux --accept-flake-config --option allow-import-from-derivation false
45141
agents:
46142
system: x86_64-linux
47143

@@ -50,3 +146,10 @@ steps:
50146
- nix-instantiate release.nix -A required-unstable-ghc8107-x86_64-darwin-native --show-trace --builders ''
51147
agents:
52148
system: x86_64-linux
149+
150+
- label: 'Check hix -- run github:haskell/cabal/3.8#cabal-install:exe:cabal -- --version'
151+
command:
152+
- "HIX_DIR=$(mktemp -d) nix run .#hix --accept-flake-config -- run github:haskell/cabal/3.8#cabal-install:exe:cabal --accept-flake-config --override-input haskellNix . -- --version"
153+
agents:
154+
system: x86_64-linux
155+

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ its dependencies into Nix code.
99
## Documentation
1010

1111
- [Introduction](https://input-output-hk.github.io/haskell.nix/index.html)
12-
- [Getting Started](https://input-output-hk.github.io/haskell.nix/tutorials/getting-started.html)
13-
- [Troubleshooting](https://input-output-hk.github.io/haskell.nix/troubleshooting.html)
12+
- [Getting Started](https://input-output-hk.github.io/haskell.nix/tutorials/getting-started)
13+
- [Troubleshooting](https://input-output-hk.github.io/haskell.nix/troubleshooting)
1414
- Explore the documentation from there to find further topics.
1515

1616
## Help! Something isn't working
1717

1818
The #1 problem that people have when using `haskell.nix` is that they find themselves building GHC.
1919
This should not happen, but you *must* follow the `haskell.nix` setup instructions properly to avoid it.
2020
If you find this happening to you, please check that you have followed the
21-
[getting started instructions](https://input-output-hk.github.io/haskell.nix/tutorials/getting-started.html#setting-up-the-binary-cache) and
22-
consult the corresponding [troubleshooting section](https://input-output-hk.github.io/haskell.nix/troubleshooting.html#why-am-i-building-ghc).
21+
[getting started instructions](https://input-output-hk.github.io/haskell.nix/tutorials/getting-started#setting-up-the-binary-cache) and
22+
consult the corresponding [troubleshooting section](https://input-output-hk.github.io/haskell.nix/troubleshooting#why-am-i-building-ghc).
2323

2424
The troubleshooting documentation also contains some help for other common issues.
2525
Please give it a read before asking on IRC or opening an issue.

build.nix

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
let
66
haskellNix = (import ./default.nix {});
77
in
8-
{ nixpkgs ? haskellNix.sources.nixpkgs-2111
8+
{ nixpkgs ? haskellNix.sources.nixpkgs-2205
99
, nixpkgsArgs ? haskellNix.nixpkgsArgs
1010
, pkgs ? import nixpkgs nixpkgsArgs
1111
, evalPackages ? import nixpkgs nixpkgsArgs
@@ -34,7 +34,6 @@ in rec {
3434
"ghc884" = "3.3.6";
3535
}.compiler-nix-name or "latest";
3636
};
37-
} // pkgs.lib.optionalAttrs (!__elem compiler-nix-name ["ghc921" "ghc922" "ghc923" "ghc924"]) {
3837
hls-latest = tool compiler-nix-name "haskell-language-server" { inherit evalPackages; };
3938
})
4039
);
@@ -77,10 +76,14 @@ in rec {
7776
];
7877
};
7978
check-materialization-concurrency = pkgs.buildPackages.callPackage ./scripts/check-materialization-concurrency/check.nix {};
80-
check-path-support = pkgs.buildPackages.callPackage ./scripts/check-path-support.nix {
81-
# TODO remove this when nixpkgs-2205 is released and used for `pkgs`
82-
# check-path-support fails unless we have nix 2.4 or newer.
83-
inherit (import haskellNix.sources.nixpkgs-unstable {}) nix;
79+
# Forcing nixpkgs-unstable here because this test makes a script
80+
# that when run will build `aeson` (used by `tests/cabal-simple`)
81+
# and we currently do not build that on hydra for nixpkgs-2205 (used by `pkgs`).
82+
# Using nixpkgs-unstable should allow buildkite to find what it needs
83+
# in the hydra cache when it runs the script.
84+
check-path-support = (import haskellNix.sources.nixpkgs-unstable nixpkgsArgs)
85+
.buildPackages.callPackage ./scripts/check-path-support.nix {
86+
inherit compiler-nix-name;
8487
};
8588
};
8689

builder/comp-builder.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ let
239239
(lib.concatMap (c: if c.isHaskell or false
240240
then builtins.attrValues (c.components.exes or {})
241241
else [c]) build-tools) ++
242-
lib.optional (pkgconfig != []) buildPackages.pkgconfig;
242+
lib.optional (pkgconfig != []) buildPackages.cabalPkgConfigWrapper;
243243

244244
# Unfortunately, we need to wrap ghc commands for cabal builds to
245245
# work in the nix-shell. See ../doc/removing-with-package-wrapper.md.
@@ -370,7 +370,7 @@ let
370370
frameworks # Frameworks will be needed at link time
371371
# Not sure why pkgconfig needs to be propagatedBuildInputs but
372372
# for gi-gtk-hs it seems to help.
373-
++ builtins.concatLists pkgconfig
373+
++ map pkgs.lib.getDev (builtins.concatLists pkgconfig)
374374
++ lib.optionals (stdenv.hostPlatform.isWindows)
375375
(lib.flatten component.libs
376376
++ map haskellLib.dependToLib component.depends);

builder/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ let
1717
# in the native case, it would be the same in the cross case however
1818
# we *really* want to build the Setup.hs on the build machine and not
1919
# have the stdenv confuse it with the target/host env.
20-
inherit (buildPackages) stdenv pkgconfig;
20+
inherit (buildPackages) stdenv;
2121
inherit buildPackages;
2222
inherit haskellLib nonReinstallablePkgs makeSetupConfigFiles;
2323
};

builder/hspkg-builder.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ let
5353
||
5454
# These are the dependencies of `Cabal`
5555
!builtins.elem package.identifier.name
56-
["nix-tools" "alex" "happy" "hscolour" "Cabal" "bytestring" "aeson" "time"
56+
["nix-tools" "alex" "happy" "hscolour" "Cabal" "Cabal-syntax" "bytestring" "aeson" "time"
5757
"filepath" "base-compat-batteries" "base-compat" "unix" "directory" "transformers"
5858
"containers" "binary" "mtl" "text" "process" "parsec"];
5959

builder/make-config-files.nix

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ let
1111

1212
flagsAndConfig = field: xs: lib.optionalString (xs != []) ''
1313
echo ${lib.concatStringsSep " " (map (x: "--${field}=${x}") xs)} >> $out/configure-flags
14-
echo "${field}: ${lib.concatStringsSep " " xs}" >> $out/cabal.config
14+
${lib.concatStrings (map (x: ''
15+
echo "${field}: ${x}" >> $out/cabal.config
16+
'') xs)}
1517
'';
1618

1719
target-pkg = "${ghc.targetPrefix}ghc-pkg";
@@ -127,8 +129,11 @@ let
127129
done
128130
129131
${ # Note: we pass `clear` first to ensure that we never consult the implicit global package db.
130-
flagsAndConfig "package-db" ["clear" "$out/${packageCfgDir}"]
132+
# However in `cabal.config` `cabal` requires `global` to be first.
133+
flagsAndConfig "package-db" ["clear"]
131134
}
135+
echo "package-db: global" >> $out/cabal.config
136+
${ flagsAndConfig "package-db" ["$out/${packageCfgDir}"] }
132137
133138
echo ${lib.concatStringsSep " " (lib.mapAttrsToList (fname: val: "--flags=${lib.optionalString (!val) "-" + fname}") flags)} >> $out/configure-flags
134139

builder/setup-builder.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{ pkgs, stdenv, lib, buildPackages, haskellLib, ghc, nonReinstallablePkgs, hsPkgs, makeSetupConfigFiles, pkgconfig }@defaults:
1+
{ pkgs, stdenv, lib, buildPackages, haskellLib, ghc, nonReinstallablePkgs, hsPkgs, makeSetupConfigFiles }@defaults:
22

33
let self =
44
{ component, package, name, src, enableDWARF ? false, flags ? {}, revision ? null, patches ? [], defaultSetupSrc
@@ -38,7 +38,7 @@ let
3838
(lib.concatMap (c: if c.isHaskell or false
3939
then builtins.attrValues (c.components.exes or {})
4040
else [c]) component.build-tools) ++
41-
lib.optional (component.pkgconfig != []) pkgconfig;
41+
lib.optional (component.pkgconfig != []) buildPackages.cabalPkgConfigWrapper;
4242

4343
drv =
4444
stdenv.mkDerivation ({

builder/shell-for.nix

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,12 @@ let
7878
++ lib.optionals packageSetupDeps (map (p: p.setup.config)
7979
(lib.filter (p: p.buildType != "Simple") selectedPackages));
8080

81-
name = if lib.length selectedPackages == 1
81+
identifierName = if lib.length selectedPackages == 1
8282
then "ghc-shell-for-${(lib.head selectedPackages).identifier.name}"
8383
else "ghc-shell-for-packages";
8484

85+
name = if (mkDrvArgs.name or null) == null then identifierName else mkDrvArgs.name;
86+
8587
# We need to remove any dependencies which would bring in selected components (see above).
8688
packageInputs = removeSelectedInputs (lib.concatMap (cfg: cfg.depends) selectedConfigs)
8789
++ additionalPackages;
@@ -93,11 +95,14 @@ let
9395
#
9496
# Also, we take care to keep duplicates out of the list, otherwise we may see
9597
# "Argument list too long" errors from bash when entering a shell.
96-
uniqueInputs = inputList: builtins.listToAttrs (builtins.map (x: lib.nameValuePair (x.name) x) inputList);
97-
unionComponentInputs = inputsSoFar: c:
98-
inputsSoFar // uniqueInputs c.buildInputs // uniqueInputs c.propagatedBuildInputs;
99-
systemInputs' = lib.lists.foldl unionComponentInputs {} selectedComponents;
100-
systemInputs = removeSelectedInputs (builtins.attrValues systemInputs');
98+
#
99+
# Version of `lib.unique` that should be fast if the name attributes are unique
100+
uniqueWithName = list:
101+
lib.concatMap lib.unique (
102+
builtins.attrValues (
103+
builtins.groupBy (x: if __typeOf x == "set" then x.name or "noname" else "notset") list));
104+
allSystemInputs = lib.concatMap (c: c.buildInputs ++ c.propagatedBuildInputs) selectedComponents;
105+
systemInputs = removeSelectedInputs (uniqueWithName allSystemInputs);
101106

102107
nativeBuildInputs = removeSelectedInputs
103108
(lib.concatMap (c: c.executableToolDepends) selectedComponents);
@@ -111,14 +116,14 @@ let
111116
doExactConfig = false;
112117
};
113118
configFiles = makeConfigFiles {
114-
fullName = args.name or name;
115-
identifier.name = name;
119+
fullName = name;
120+
identifier.name = identifierName;
116121
inherit component enableDWARF;
117122
chooseDrv = p: if withHaddock && p ? haddock then p.haddock else p;
118123
};
119124
ghcEnv = ghcForComponent {
120125
inherit configFiles;
121-
componentName = name;
126+
componentName = identifierName;
122127
postInstall = lib.optionalString withHoogle' ''
123128
ln -s ${hoogleIndex}/bin/hoogle $out/bin
124129
'';
@@ -152,7 +157,7 @@ let
152157
mkDrvArgs = builtins.removeAttrs args ["packages" "components" "additional" "withHoogle" "tools"];
153158
in
154159
mkShell (mkDrvArgs // {
155-
name = mkDrvArgs.name or name;
160+
inherit name;
156161

157162
buildInputs = systemInputs
158163
++ mkDrvArgs.buildInputs or [];

ci.nix

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
inherit (import ./ci-lib.nix { inherit pkgs; }) dimension platformFilterGeneric filterAttrsOnlyRecursive;
1111
inherit (pkgs.haskell-nix) sources;
1212
nixpkgsVersions = {
13-
"R2111" = "nixpkgs-2111";
1413
"R2205" = "nixpkgs-2205";
1514
"unstable" = "nixpkgs-unstable";
1615
};
@@ -30,17 +29,14 @@
3029
# cabal-install and nix-tools plans. When removing a ghc version
3130
# from here (so that is no longer cached) also remove ./materialized/ghcXXX.
3231
# Update supported-ghc-versions.md to reflect any changes made here.
33-
nixpkgs.lib.optionalAttrs (nixpkgsName == "R2111") {
32+
nixpkgs.lib.optionalAttrs (nixpkgsName == "R2205") {
3433
ghc865 = false;
35-
ghc8107 = true;
36-
} // nixpkgs.lib.optionalAttrs (nixpkgsName == "R2205") {
37-
ghc865 = false;
38-
ghc8107 = true;
34+
ghc8107 = false;
3935
} // nixpkgs.lib.optionalAttrs (nixpkgsName == "unstable") {
4036
ghc865 = false;
4137
ghc884 = false; # Native version is used to boot 9.0.1
4238
ghc8107 = true;
43-
ghc902 = true;
39+
ghc902 = false;
4440
ghc924 = true;
4541
});
4642
systems = nixpkgsName: nixpkgs: compiler-nix-name: nixpkgs.lib.genAttrs (

default.nix

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
{...}@args:
22

33
let
4+
pins = (__fromJSON (__readFile ./flake.lock)).nodes;
5+
nixpkgsPin = pins.nixpkgs-2205.locked;
6+
flakeCompatPin = pins.flake-compat.locked;
47
nixpkgsSrc =
58
builtins.fetchTarball {
6-
url = "https://github.com/NixOS/nixpkgs/archive/110a2c9ebbf5d4a94486854f18a37a938cfacbbb.tar.gz";
7-
sha256 = "sha256-leWXLchbAbqOlLT6tju631G40SzQWPqaAXQG3zH1Imw=";
9+
url = "https://github.com/NixOS/nixpkgs/archive/${nixpkgsPin.rev}.tar.gz";
10+
sha256 = nixpkgsPin.narHash;
811
};
912
pkgs = args.pkgs or (import nixpkgsSrc {});
1013
flake-compat =
1114
pkgs.fetchzip {
12-
url = "https://github.com/edolstra/flake-compat/archive/5523c47f13259b981c49b26e28499724a5125fd8.tar.gz";
13-
sha256 = "sha256-7IySNHriQjzOZ88DDk6VDPf1GoUaOrOeUdukY62o52o=";
15+
url = "https://github.com/input-output-hk/flake-compat/archive/${flakeCompatPin.rev}.tar.gz";
16+
sha256 = flakeCompatPin.narHash;
1417
};
1518
self = import flake-compat {
1619
# We bypass flake-compat's rootSrc cleaning by evading its detection of this as a git

0 commit comments

Comments
 (0)