Skip to content

Commit ad3f9e8

Browse files
committed
Merge branch 'master' of github.com:input-output-hk/haskell.nix into circuithub
2 parents d3c8653 + 9f75bfd commit ad3f9e8

File tree

23 files changed

+151
-66
lines changed

23 files changed

+151
-66
lines changed

changelog.md

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

4+
## Mar 27, 2023
5+
6+
Haskell.nix will no longer parse the `cabal.project` file to
7+
determine the `index-state`. This decision was made due to
8+
the function's inability to handle more than one `index-state`
9+
or a qualified `index-state` as the first `index-state`
10+
field in the file.
11+
12+
As a result, there will be some drawbacks:
13+
14+
* There will no longer be a warning in the trace output
15+
if an index state is not found.
16+
17+
* Even if the `index-state:` in the `cabal.project` has not changed,
18+
the plan will be recomputed when hackage.nix is bumped. However, this
19+
is not expected to be a problem since plan recomputations are typically
20+
quick.
21+
22+
* `project.index-state` cannot be used to obtain the found `index-state`.
23+
However, the parse function is still available if required
24+
(haskell-nix.haskellLib.parseIndexState).
25+
426
## Jul 27, 2022
527
* Removed reliance on `builtins.currentSystem`. It was used it to provide
628
`pkgs.evalPackages` via an overlay that it used to run derivations

ci.nix

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,11 @@
6565
# of 'lib.systems.examples' are not understood between all versions
6666
let lib = nixpkgs.lib;
6767
in lib.optionalAttrs (nixpkgsName == "unstable"
68-
&& ((system == "x86_64-linux" && __elem compiler-nix-name ["ghc865" "ghc884" "ghc8107" "ghc961"])
69-
|| (system == "x86_64-darwin" && __elem compiler-nix-name ["ghc8107" "ghc961"]))) {
68+
&& ((system == "x86_64-linux" && __elem compiler-nix-name ["ghc8107" "ghc961"])
69+
|| (system == "aarch64-linux" && __elem compiler-nix-name ["ghc8107" "ghc961"])
70+
|| (system == "x86_64-darwin" && __elem compiler-nix-name ["ghc8107" "ghc961"])
71+
|| (system == "aarch64-darwin" && __elem compiler-nix-name ["ghc8107" "ghc961"])
72+
)) {
7073
inherit (lib.systems.examples) ghcjs;
7174
} // lib.optionalAttrs (nixpkgsName == "unstable"
7275
&& ((system == "x86_64-linux" && __elem compiler-nix-name ["ghc8107" "ghc902" "ghc926" "ghc927" "ghc944" "ghc961"])

compiler/ghc/default.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,10 @@ stdenv.mkDerivation (rec {
684684
${hadrian}/bin/hadrian ${hadrianArgs} stage1:lib:terminfo
685685
'' + lib.optionalString (installStage1 && !haskell-nix.haskellLib.isCrossTarget) ''
686686
${hadrian}/bin/hadrian ${hadrianArgs} stage2:exe:iserv
687+
# I don't seem to be able to build _build/stage1/lib/bin/ghc-iserv-prof
688+
# by asking hadrian for this. The issue is likely that the profiling way
689+
# is probably missing from hadrian m(
690+
${hadrian}/bin/hadrian ${hadrianArgs} _build/stage1/lib/bin/ghc-iserv-prof
687691
pushd _build/stage1/bin
688692
for exe in *; do
689693
mv $exe ${targetPrefix}$exe

flake.lock

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

hix/init/flake.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
hixProject =
2020
final.haskell-nix.hix.project {
2121
src = ./.;
22-
evalSystem = "EVAL_SYSTEM";
22+
# uncomment with your current system for `nix flake show` to work:
23+
#evalSystem = "EVAL_SYSTEM";
2324
};
2425
})
2526
];

lib/call-cabal-project-to-nix.nix

Lines changed: 10 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -151,46 +151,29 @@ in let
151151
}
152152
'';
153153

154-
cabalProjectIndexState = pkgs.haskell-nix.haskellLib.parseIndexState rawCabalProject;
155-
156-
index-state-found =
154+
index-state-max =
157155
if index-state != null
158156
then index-state
159-
else if cabalProjectIndexState != null
160-
then cabalProjectIndexState
161-
else
162-
let latest-index-state = pkgs.lib.last (builtins.attrNames index-state-hashes);
163-
in builtins.trace ("No index state specified" + (if name == null then "" else " for " + name) + ", using the latest index state that we know about (${latest-index-state})!") latest-index-state;
164-
165-
index-state-pinned = index-state != null || cabalProjectIndexState != null;
157+
else pkgs.lib.last (builtins.attrNames index-state-hashes);
166158

167159
pkgconfPkgs = import ./pkgconf-nixpkgs-map.nix pkgs;
168160

169-
in
170-
assert (if index-state-found == null
171-
then throw "No index state passed and none found in ${cabalProjectFileName}" else true);
172-
173-
assert (if index-sha256 == null && !(pkgs.lib.hasSuffix "Z" index-state-found)
174-
then throw "Index state found was ${index-state-found} and no `index-sha256` was provided. "
175-
"The index hash lookup code requires zulu time zone (ends in a Z)" else true);
176-
177-
let
178161
# If a hash was not specified find a suitable cached index state to
179162
# use that will contain all the packages we need. By using the
180163
# first one after the desired index-state we can avoid recalculating
181164
# when new index-state-hashes are added.
182165
# See https://github.com/input-output-hk/haskell.nix/issues/672
183166
cached-index-state = if index-sha256 != null
184-
then index-state-found
167+
then index-state-max
185168
else
186169
let
187170
suitable-index-states =
188171
builtins.filter
189-
(s: s >= index-state-found) # This compare is why we need zulu time
172+
(s: s >= index-state-max) # This compare is why we need zulu time
190173
(builtins.attrNames index-state-hashes);
191174
in
192175
if builtins.length suitable-index-states == 0
193-
then index-state-found
176+
then index-state-max
194177
else pkgs.lib.head suitable-index-states;
195178

196179
# Lookup hash for the index state we found
@@ -200,7 +183,7 @@ let
200183

201184
in
202185
assert (if index-sha256-found == null
203-
then throw "Unknown index-state ${index-state-found}, the latest index-state I know about is ${pkgs.lib.last (builtins.attrNames index-state-hashes)}. You may need to update to a newer hackage.nix." else true);
186+
then throw "Unknown index-state ${index-state-max}, the latest index-state I know about is ${pkgs.lib.last (builtins.attrNames index-state-hashes)}. You may need to update to a newer hackage.nix." else true);
204187

205188
let
206189
# Deal with source-repository-packages in a way that will work in
@@ -392,11 +375,6 @@ let
392375
sha256 = plan-sha256;
393376
sha256Arg = "plan-sha256";
394377
this = "project.plan-nix" + (if name != null then " for ${name}" else "");
395-
# Before pinning stuff down we need an index state to use
396-
reasonNotSafe =
397-
if !index-state-pinned
398-
then "index-state is not pinned by an argument or the cabal project file"
399-
else null;
400378
} // pkgs.lib.optionalAttrs (checkMaterialization != null) {
401379
inherit checkMaterialization;
402380
}) (evalPackages.runCommand (nameAndSuffix "plan-to-nix-pkgs") {
@@ -470,12 +448,11 @@ let
470448
export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
471449
export GIT_SSL_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt
472450
473-
echo "Using index-state ${index-state-found}"
474451
CABAL_DIR=${
475452
# This creates `.cabal` directory that is as it would have
476453
# been at the time `cached-index-state`. We may include
477-
# some packages that will be excluded by `index-state-found`
478-
# which is used by cabal (cached-index-state >= index-state-found).
454+
# some packages that will be excluded by `index-state-max`
455+
# which is used by cabal (cached-index-state >= index-state-max).
479456
dotCabal {
480457
inherit cabal-install nix-tools extra-hackage-tarballs;
481458
extra-hackage-repos = fixedProject.repos;
@@ -485,7 +462,7 @@ let
485462
} make-install-plan ${
486463
# Setting the desired `index-state` here in case it is not
487464
# in the cabal.project file. This will further restrict the
488-
# packages used by the solver (cached-index-state >= index-state-found).
465+
# packages used by the solver (cached-index-state >= index-state-max).
489466
pkgs.lib.optionalString (index-state != null) "--index-state=${index-state}"
490467
} \
491468
-w ${
@@ -548,7 +525,6 @@ let
548525
'');
549526
in {
550527
projectNix = plan-nix;
551-
index-state = index-state-found;
552-
inherit src;
528+
inherit index-state-max src;
553529
inherit (fixedProject) sourceRepos extra-hackages;
554530
}

nix-tools/flake.nix

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
hixProject =
1818
final.haskell-nix.hix.project {
1919
src = ./.;
20-
evalSystem = "x86_64-darwin";
2120
compiler-nix-name = __head compilers;
2221
};
2322
})

overlays/hix.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ final: prev: { haskell-nix = prev.haskell-nix // { hix = {
3535
then {}
3636
else import src;
3737
projectDefaults = importDefaults (toString (src.origSrcSubDir or src) + "/nix/hix.nix");
38-
in final.haskell-nix.project [
38+
in final.haskell-nix.project' [
3939
(import ../modules/hix-project.nix)
4040
projectDefaults
4141
commandArgs'

test/buildable/default.nix

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ in recurseIntoAttrs {
2525
touch $out
2626
'';
2727

28-
meta.platforms = platforms.all;
28+
meta = rec {
29+
platforms = lib.platforms.all;
30+
broken = stdenv.hostPlatform.isGhcjs && __elem compiler-nix-name ["ghc961"];
31+
disabled = broken;
32+
};
2933

3034
passthru = {
3135
# Attributes used for debugging with nix repl

test/c-ffi/default.nix

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ in recurseIntoAttrs {
5555
touch $out
5656
'';
5757

58-
meta.platforms = platforms.all;
58+
meta = rec {
59+
platforms = lib.platforms.all;
60+
broken = stdenv.hostPlatform.isGhcjs && __elem compiler-nix-name ["ghc961"];
61+
disabled = broken;
62+
};
5963

6064
passthru = {
6165
# Used for debugging with nix repl

0 commit comments

Comments
 (0)