Skip to content

Commit 665eb3d

Browse files
authored
update nix-tools-static.nix (#2268)
* Update nix-tools and use GHC 9.6.7 and Cabal 3.14 to build them * Add libc++abi.dylib to fixup-nix-deps * Fix wait for hydra * Use new json format in dummy ghc code * Fix index-state issues (related to use of newer Cabal in make-install-plan) * Fix error output formatting now that details of failures are in exceptions thrown by the Cabal planner (they were printed before).
1 parent 462ec8f commit 665eb3d

File tree

15 files changed

+164
-260
lines changed

15 files changed

+164
-260
lines changed

Diff for: compiler/ghc/default.nix

-1
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,6 @@ let
269269
inherit compiler-nix-name;
270270
name = "hadrian";
271271
compilerSelection = p: p.haskell.compiler;
272-
index-state = buildPackages.haskell-nix.internalHackageIndexState;
273272
evalPackages = hadrianEvalPackages;
274273
modules = [{
275274
reinstallableLibGhc = false;

Diff for: lib/call-cabal-project-to-nix.nix

+15-7
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ in let
151151
let
152152
suitable-index-states =
153153
builtins.filter
154-
(s: s >= index-state-max) # This compare is why we need zulu time
154+
(s: s > index-state-max) # This compare is why we need zulu time
155155
(builtins.attrNames index-state-hashes);
156156
in
157157
if builtins.length suitable-index-states == 0
@@ -518,22 +518,30 @@ let
518518
json_cabal_file=$(mktemp)
519519
cabal2json $fixed_cabal_file > $json_cabal_file
520520
521-
exposed_modules="$(jq -r '.library."exposed-modules"//[]|.[]|select(type=="array")[]' $json_cabal_file)"
522-
reexported_modules="$(jq -r '.library."reexported-modules"//[]|.[]|select(type=="array")[]' $json_cabal_file | sed 's/.* as //g')"
521+
exposed_modules="$(jq -r '.components.lib."exposed-modules"//[]|.[]|select(type=="string")' $json_cabal_file)"
522+
reexported_modules="$(jq -r '.components.lib."reexported-modules"//[]|.[]|select(type=="string")' $json_cabal_file | sed 's/.* as //g')"
523523
524524
# FIXME This is a bandaid. Rather than doing this, conditionals should be interpreted.
525525
${pkgs.lib.optionalString pkgs.stdenv.targetPlatform.isGhcjs ''
526-
exposed_modules+=" $(jq -r '.library."exposed-modules"//[]|.[]|select(type=="object" and .if.arch == "javascript")|.then[]' $json_cabal_file)"
526+
exposed_modules+=" $(jq -r '.components.lib."exposed-modules"//[]|.[]|select(type=="object" and ._if.arch == "javascript")|._then[]' $json_cabal_file)"
527527
''}
528528
${pkgs.lib.optionalString pkgs.stdenv.targetPlatform.isWindows ''
529-
exposed_modules+=" $(jq -r '.library."exposed-modules"//[]|.[]|select(type=="object" and .if.os == "windows")|.then[]' $json_cabal_file)"
529+
exposed_modules+=" $(jq -r '.components.lib."exposed-modules"//[]|.[]|select(type=="object" and ._if.os == "windows")|._then[]' $json_cabal_file)"
530530
''}
531531
${pkgs.lib.optionalString (!pkgs.stdenv.targetPlatform.isWindows) ''
532-
exposed_modules+=" $(jq -r '.library."exposed-modules"//[]|.[]|select(type=="object" and .if.not.os == "windows")|.then[]' $json_cabal_file)"
532+
exposed_modules+=" $(jq -r '.components.lib."exposed-modules"//[]|.[]|select(type=="object" and ._if.not.os == "windows")|._then[]' $json_cabal_file)"
533533
''}
534534
535535
EXPOSED_MODULES_${varname name}="$(tr '\n' ' ' <<< "$exposed_modules $reexported_modules")"
536-
DEPS_${varname name}="$(jq -r '.library."build-depends"[]|select(type=="array")[],select(type=="object" and .if.not.flag != "vendor-filepath").then[]' $json_cabal_file | sed 's/^\([A-Za-z0-9-]*\).*$/\1/g' | sort -u | tr '\n' ' ')"
536+
deps="$(jq -r '.components.lib."build-depends"[]|select(.package)|.package' $json_cabal_file)"
537+
deps+=" $(jq -r '.components.lib."build-depends"[]|select((.if.flag or ._if.not.flag) and ._if.not.flag != "vendor-filepath")._then[]|.package' $json_cabal_file)"
538+
${pkgs.lib.optionalString pkgs.stdenv.targetPlatform.isWindows ''
539+
deps+=" $(jq -r '.components.lib."build-depends"[]|select(._if.os == "windows")|._then[]|.package' $json_cabal_file)"
540+
''}
541+
${pkgs.lib.optionalString (!pkgs.stdenv.targetPlatform.isWindows) ''
542+
deps+=" $(jq -r '.components.lib."build-depends"[]|select(._if.not.os == "windows")|._then[]|.package' $json_cabal_file)"
543+
''}
544+
DEPS_${varname name}="$(tr '\n' ' ' <<< "$deps")"
537545
VER_${varname name}="$(jq -r '.version' $json_cabal_file)"
538546
PKGS+=" ${name}"
539547
LAST_PKG="${name}"

Diff for: nix-tools-static.nix

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
pkgs: let baseurl = "https://github.com/input-output-hk/haskell.nix/releases/download/nix-tools-0.2.6/"; in {
1+
pkgs: let baseurl = "https://github.com/input-output-hk/haskell.nix/releases/download/nix-tools-0.3.2/"; in {
22
aarch64-darwin = pkgs.fetchurl {
33
name = "aarch64-darwin-nix-tools-static";
44
url = "${baseurl}aarch64-darwin-nix-tools-static.zip";
5-
sha256 = "sha256-9WpTIWlpUvG3pI+tcbAMh6sMH0QO/coZrxDYWD43iq0=";
5+
sha256 = "sha256-SlTAgNj3YjZpobl/aIZLI+o8EpxznW5X90UBTtHDwbw=";
66
};
77
x86_64-darwin = pkgs.fetchurl {
88
name = "x86_64-darwin-nix-tools-static";
99
url = "${baseurl}x86_64-darwin-nix-tools-static.zip";
10-
sha256 = "sha256-UUr9bo2OpLPsvHRSeO2B6DKVDVTsHepRlTqN6UZoZ2M=";
10+
sha256 = "sha256-6m2f3DoARyoxR5Fh+87TfVCLkewwhozVLKbUzfXvUxs=";
1111
};
1212
aarch64-linux = pkgs.fetchurl {
1313
name = "aarch64-linux-nix-tools-static";
1414
url = "${baseurl}aarch64-linux-nix-tools-static.zip";
15-
sha256 = "sha256-96s6RXN8st0JK0eYSOkTJvnlTxYVdE81+ZUGJEsC46A=";
15+
sha256 = "sha256-MX4u23nzjByT9zcSN+HlKOAgQNtYvcuR8iOh54wR41U=";
1616
};
1717
x86_64-linux = pkgs.fetchurl {
1818
name = "x86_64-linux-nix-tools-static";
1919
url = "${baseurl}x86_64-linux-nix-tools-static.zip";
20-
sha256 = "sha256-LMFVUKNycjVFBb3ChZsPbRNgab50zOHl7nMBrDdeTrQ=";
20+
sha256 = "sha256-QzTCy7HPY5xN6VFKJcibE1gWLsT4u8OPfJHvDMK3v7M=";
2121
};
2222
}

Diff for: nix-tools/cabal.project

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
index-state: 2024-10-15T20:31:31Z
1+
index-state: 2025-04-12T00:00:00Z
2+
3+
-- Needed for building aarch64-linux musl version with GHC 9.6
4+
constraints: containers installed, Cabal >=3.14.1.0
5+
allow-older: Cabal-syntax-json:base, Cabal-syntax-json:containers
26

37
packages: nix-tools
48

@@ -36,5 +40,5 @@ source-repository-package
3640
source-repository-package
3741
type: git
3842
location: https://github.com/andreabedini/Cabal-syntax-json.git
39-
tag: b7192832f730d9181a013ef7c77f2ad0b30cca43
40-
--sha256: sha256-Yw2HQOCmjOvfKHi3xWbSniAZfyrshOvsgmUbqFmDDpU=
43+
tag: b0033ed4d00a09340c64f4290cc649f4009deabd
44+
--sha256: sha256-Aymi25AQLSMextVeXbsMnaOppxAO93qVbwo7Vt44ej4=

0 commit comments

Comments
 (0)