Skip to content

Commit

Permalink
Update nixpkgs pins (#2250)
Browse files Browse the repository at this point in the history
* Update nixpkgs pins

* ifdLevel 0

* Simplify bootPkgs

* Update materialized files

* Bump nixpkgs-unstable and ghc911

* Simplify bootPkgs

* Simplify bootPkgs

* Update ghc911

* Reduce the number of compilers tested

* Bump llvm for ghc >=9.10

* Update patch upper bounds

* Include clang for useLLVM GHC

* ifdLevel 1

* Add materialized files

* Disable haskell-gi-overloading (it's too slow to build)

* Update patch upper bound

* ifdLevel 2

* Fixes for GHC HEAD

* ifdLevel 3

* Fixes for GHC HEAD

* Fix supported-languages for GHC HEAD

* More fixes for GHC HEAD

* Possible fix for plugin failure on aarch64-darwin

* ifdLevel 0

* ifdLevel 3

* Add emar and emranlib to ghc js builds

* Fix `repo-tar` downloads

* Fix `repo-tar` downloads

* More fixes for ghc HEAD

* Fix for GHC 9.6 JS backend

* Fix for GHC HEAD JS

* ifdLevel 0

* ifdLevel 1

* Avoid building source-pins on hackage (just make sure the components needed are present).

* ifdLevel 2

* ifdLevel 3

* Add missing materialized file

* Fix gi-gtk test
  • Loading branch information
hamishmack authored Oct 3, 2024
1 parent e35f00f commit a8026bd
Show file tree
Hide file tree
Showing 84 changed files with 10,139 additions and 886 deletions.
20 changes: 9 additions & 11 deletions ci.nix
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,17 @@
# from here (so that is no longer cached) also remove ./materialized/ghcXXX.
# Update supported-ghc-versions.md to reflect any changes made here.
nixpkgs.lib.optionalAttrs (nixpkgsName == "R2405") {
ghc94 = false;
ghc96 = false;
ghc98 = false;
} // nixpkgs.lib.optionalAttrs (nixpkgsName == "unstable") {
ghc810 = true;
ghc90 = false;
ghc92 = true;
ghc94 = true;
ghc92 = false;
ghc94 = false;
ghc96 = true;
ghc96llvm = true;
ghc98 = true;
ghc98llvm = true;
ghc98llvm = false;
ghc910 = true;
ghc910llvm = true;
ghc911 = true;
})));
crossSystems = nixpkgsName: nixpkgs: compiler-nix-name:
Expand All @@ -85,21 +83,21 @@
&& (__match ".*llvm" compiler-nix-name == null)
&& ((system == "x86_64-linux" && !builtins.elem compiler-nix-name ["ghc884" "ghc902" "ghc928" "ghc948"])
|| (system == "aarch64-linux" && !builtins.elem compiler-nix-name ["ghc884" "ghc902" "ghc928" "ghc948"])
|| (system == "x86_64-darwin" && !builtins.elem compiler-nix-name ["ghc884" "ghc902" "ghc928" "ghc948"])
|| (system == "aarch64-darwin" && !builtins.elem compiler-nix-name ["ghc884" "ghc902" "ghc928" "ghc948"])
|| (system == "x86_64-darwin" && !builtins.elem compiler-nix-name ["ghc884" "ghc902" "ghc928" "ghc948" "ghc966" "ghc982"])
|| (system == "aarch64-darwin" && !builtins.elem compiler-nix-name ["ghc884" "ghc902" "ghc928" "ghc948" "ghc966" "ghc982"])
)) {
inherit (lib.systems.examples) ghcjs;
} // lib.optionalAttrs (
(__match ".*llvm" compiler-nix-name == null)
&& ((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
&& ((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
|| (system == "x86_64-darwin" && builtins.elem compiler-nix-name []))) { # TODO add ghc versions when we have more darwin build capacity
inherit (lib.systems.examples) mingwW64;
} // lib.optionalAttrs (nixpkgsName == "unstable"
&& (__match ".*llvm" compiler-nix-name == null)
&& ((system == "x86_64-linux" && !builtins.elem compiler-nix-name ["ghc884" "ghc8107" "ghc902" "ghc928"])
&& ((system == "x86_64-linux" && !builtins.elem compiler-nix-name ["ghc884" "ghc8107" "ghc902" "ghc928" "ghc948"])
|| (system == "x86_64-darwin" && builtins.elem compiler-nix-name []))) { # TODO add ghc versions when we have more darwin build capacity
inherit (lib.systems.examples) ucrt64;
} // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "unstable" && !builtins.elem compiler-nix-name ["ghc884"]) {
} // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "unstable" && !builtins.elem compiler-nix-name ["ghc884" "ghc902" "ghc928" "ghc948"]) {
# Musl cross only works on linux
# aarch64 cross only works on linux
inherit (lib.systems.examples) musl64 aarch64-multiplatform;
Expand Down
30 changes: 18 additions & 12 deletions compiler/ghc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ let
if targetPlatform.isGhcjs
then [ buildPackages.emscripten ]
else if hostPlatform == buildPlatform
then [ targetPackages.stdenv.cc ] ++ lib.optional useLLVM llvmPackages.llvm
then [ targetPackages.stdenv.cc ] ++ lib.optionals useLLVM [llvmPackages.llvm llvmPackages.clang]
else assert targetPlatform == hostPlatform; # build != host == target
[ stdenv.cc ] ++ lib.optional useLLVM buildLlvmPackages.llvm;

Expand Down Expand Up @@ -362,14 +362,8 @@ let
# Sometimes we have to dispatch between the bintools wrapper and the unwrapped
# derivation for certain tools depending on the platform.
bintoolsFor = {
# GHC needs install_name_tool on all darwin platforms. On aarch64-darwin it is
# part of the bintools wrapper (due to codesigning requirements), but not on
# x86_64-darwin.
install_name_tool =
if stdenv.targetPlatform.isAarch64
then targetCC.bintools
else targetCC.bintools.bintools;
# Same goes for strip.
# GHC needs install_name_tool on all darwin platforms.
install_name_tool = targetCC.bintools.bintools;
strip =
# TODO(@sternenseemann): also use wrapper if linker == "bfd" or "gold"
if stdenv.targetPlatform.isAarch64
Expand Down Expand Up @@ -403,14 +397,26 @@ stdenv.mkDerivation (rec {
done
''
# Use emscripten and the `config.sub` saved by `postPatch`
+ lib.optionalString (targetPlatform.isGhcjs) ''
+ lib.optionalString (targetPlatform.isGhcjs) (''
export CC="${targetCC}/bin/emcc"
export CXX="${targetCC}/bin/em++"
export LD="${targetCC}/bin/emcc"
export NM="${targetCC}/share/emscripten/emnm"
'' + (
# Including AR and RANLIB here breaks tests.js-template-haskell for GHC 9.6
# `LLVM ERROR: malformed uleb128, extends past end`
if builtins.compareVersions ghc-version "9.8" >= 0
then ''
export AR="${targetCC}/bin/emar"
export NM="${targetCC}/share/emscripten/emnm"
export RANLIB="${targetCC}/bin/emranlib"
''
else ''
export NM="${targetCC}/share/emscripten/emnm"
''
) + ''
export EM_CACHE=$(mktemp -d)
mv config.sub.ghcjs config.sub
''
'')
# GHC is a bit confused on its cross terminology, as these would normally be
# the *host* tools.
+ lib.optionalString (!targetPlatform.isGhcjs) (''
Expand Down
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions lazy-inputs/ghc911/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

76 changes: 75 additions & 1 deletion lib/call-cabal-project-to-nix.nix
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ let
# GHCJS 8.10 does not have these
"Cabal-syntax"
"exceptions"
"file-io"
"ghc"
"ghc-bignum"
"ghc-experimental"
Expand All @@ -422,6 +423,79 @@ let
evalPackages.jq
];
} (let varname = x: builtins.replaceStrings ["-"] ["_"] x; in ''
PACKAGE_VERSION=${ghc.version}
ProjectVersion=${ghc.version}
# The following logic is from GHC m4/setup_project_version.m4
# Split PACKAGE_VERSION into (possibly empty) parts
VERSION_MAJOR=`echo $PACKAGE_VERSION | sed 's/^\([^.]*\)\(\.\{0,1\}\(.*\)\)$/\1'/`
VERSION_TMP=`echo $PACKAGE_VERSION | sed 's/^\([^.]*\)\(\.\{0,1\}\(.*\)\)$/\3'/`
VERSION_MINOR=`echo $VERSION_TMP | sed 's/^\([^.]*\)\(\.\{0,1\}\(.*\)\)$/\1'/`
ProjectPatchLevel=`echo $VERSION_TMP | sed 's/^\([^.]*\)\(\.\{0,1\}\(.*\)\)$/\3'/`
# Calculate project version as an integer, using 2 digits for minor version
case $VERSION_MINOR in
?) ProjectVersionInt=''${VERSION_MAJOR}0''${VERSION_MINOR} ;;
??) ProjectVersionInt=''${VERSION_MAJOR}''${VERSION_MINOR} ;;
*) echo bad minor version in $PACKAGE_VERSION; exit 1 ;;
esac
# AC_SUBST([ProjectVersionInt])
# The project patchlevel is zero unless stated otherwise
test -z "$ProjectPatchLevel" && ProjectPatchLevel=0
# Save split version of ProjectPatchLevel
ProjectPatchLevel1=`echo $ProjectPatchLevel | sed 's/^\([^.]*\)\(\.\{0,1\}\(.*\)\)$/\1/'`
ProjectPatchLevel2=`echo $ProjectPatchLevel | sed 's/^\([^.]*\)\(\.\{0,1\}\(.*\)\)$/\3/'`
# The project patchlevel1/2 is zero unless stated otherwise
test -z "$ProjectPatchLevel1" && ProjectPatchLevel1=0
test -z "$ProjectPatchLevel2" && ProjectPatchLevel2=0
# AC_SUBST([ProjectPatchLevel1])
# AC_SUBST([ProjectPatchLevel2])
# Remove dots from the patch level; this allows us to have versions like 6.4.1.20050508
ProjectPatchLevel=`echo $ProjectPatchLevel | sed 's/\.//'`
# AC_SUBST([ProjectPatchLevel])
# The version of the GHC package changes every day, since the
# patchlevel is the current date. We don't want to force
# recompilation of the entire compiler when this happens, so for
# GHC HEAD we omit the patchlevel from the package version number.
#
# The ProjectPatchLevel1 > 20000000 iff GHC HEAD. If it's for a stable
# release like 7.10.1 or for a release candidate such as 7.10.1.20141224
# then we don't omit the patchlevel components.
ProjectVersionMunged="$ProjectVersion"
if test "$ProjectPatchLevel1" -gt 20000000; then
ProjectVersionMunged="''${VERSION_MAJOR}.''${VERSION_MINOR}"
fi
# AC_SUBST([ProjectVersionMunged])
# The version used for libraries tightly coupled with GHC (e.g.
# ghc-internal) which need a major version bump for every minor/patchlevel
# GHC version.
# Example: for GHC=9.10.1, ProjectVersionForLib=9.1001
#
# Just like with project version munged, we don't want to use the
# patchlevel version which changes every day, so if using GHC HEAD, the
# patchlevel = 00.
case $VERSION_MINOR in
?) ProjectVersionForLibUpperHalf=''${VERSION_MAJOR}.0''${VERSION_MINOR} ;;
??) ProjectVersionForLibUpperHalf=''${VERSION_MAJOR}.''${VERSION_MINOR} ;;
*) echo bad minor version in $PACKAGE_VERSION; exit 1 ;;
esac
# GHC HEAD uses patch level version > 20000000
case $ProjectPatchLevel1 in
?) ProjectVersionForLib=''${ProjectVersionForLibUpperHalf}0''${ProjectPatchLevel1} ;;
??) ProjectVersionForLib=''${ProjectVersionForLibUpperHalf}''${ProjectPatchLevel1} ;;
*) ProjectVersionForLib=''${ProjectVersionForLibUpperHalf}00
esac
PKGS=""
${pkgs.lib.concatStrings
(builtins.map (name: ''
Expand All @@ -441,7 +515,7 @@ let
fi
if [[ "$cabal_file" != "" ]]; then
fixed_cabal_file=$(mktemp)
cat $cabal_file | sed -e 's/@ProjectVersionMunged@/${ghc.version}/g' -e 's/default: *@[A-Za-z0-9]*@/default: False/g' -e 's/@Suffix@//g' > $fixed_cabal_file
cat $cabal_file | sed -e "s/@ProjectVersionMunged@/$ProjectVersionMunged/g" -e "s/@ProjectVersionForLib@/$ProjectVersionForLib/g" -e 's/default: *@[A-Za-z0-9]*@/default: False/g' -e 's/@Suffix@//g' > $fixed_cabal_file
json_cabal_file=$(mktemp)
cabal2json $fixed_cabal_file > $json_cabal_file
Expand Down
8 changes: 7 additions & 1 deletion lib/load-cabal-plan.nix
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,13 @@ in {
} // pkgs.lib.optionalAttrs (p.pkg-src.type or "" == "source-repo") {
# Replace the source repository packages with versions created when
# parsing the `cabal.project` file.
src = pkgs.lib.lists.elemAt callProjectResults.sourceRepos (pkgs.lib.strings.toInt p.pkg-src.source-repo.location) + "/${p.pkg-src.source-repo.subdir}";
src = pkgs.lib.lists.elemAt callProjectResults.sourceRepos (pkgs.lib.strings.toInt p.pkg-src.source-repo.location)
+ pkgs.lib.optionalString (p.pkg-src.source-repo.subdir != ".") "/${p.pkg-src.source-repo.subdir}";
} // pkgs.lib.optionalAttrs (p.pkg-src.type or "" == "repo-tar") {
src = pkgs.lib.mkDefault (pkgs.fetchurl {
url = p.pkg-src.repo.uri + "${pkgs.lib.optionalString (!pkgs.lib.hasSuffix "/" p.pkg-src.repo.uri) "/"}package/${p.pkg-name}-${p.pkg-version}.tar.gz";
sha256 = p.pkg-src-sha256;
});
} // pkgs.lib.optionalAttrs (cabal2nix ? package-description-override && p.pkg-version == cabal2nix.package.identifier.version) {
# Use the `.cabal` file from the `Cabal2Nix` if it for the matching
# version of the package (the one in the plan).
Expand Down
4 changes: 4 additions & 0 deletions lib/supported-languages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -308,5 +308,9 @@ evalPackages.writeTextFile {
${pkgs.lib.optionalString (builtins.compareVersions ghc.version "9.11" >=0) ''
OrPatterns
NoOrPatterns
MultilineStrings
NoMultilineStrings
NamedDefaults
NoNamedDefaults
''}'';
}
1 change: 1 addition & 0 deletions materialized/alex-3.2.7.1/plan.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a8026bd

Please sign in to comment.