diff --git a/doc/languages-frameworks/haskell.section.md b/doc/languages-frameworks/haskell.section.md index cba4d0561b0749..f8fd5ee599263f 100644 --- a/doc/languages-frameworks/haskell.section.md +++ b/doc/languages-frameworks/haskell.section.md @@ -84,18 +84,18 @@ nix-env -qaP -A nixos.haskellPackages nix-env -iA nixos.haskellPackages.cabal-install ``` -Our current default compiler is GHC 8.8.x and the `haskellPackages` set -contains packages built with that particular version. Nixpkgs contains the last -three major releases of GHC and there is a whole family of package sets -available that defines Hackage packages built with each of those compilers, -too: +Our current default compiler is GHC 8.8.x (or 8.10.2 on aarch64) and the +`haskellPackages` set contains packages built with that particular version. + Nixpkgs contains the last three major releases of GHC and there is a whole + family of package sets available that defines Hackage packages built with + each of those compilers, too: ```shell nix-env -f "" -qaP -A haskell.packages.ghc865 -nix-env -f "" -qaP -A haskell.packages.ghc8101 +nix-env -f "" -qaP -A haskell.packages.ghc8102 ``` The name `haskellPackages` is really just a synonym for -`haskell.packages.ghc882`, because we prefer that package set internally and +`haskell.packages.ghc884`, because we prefer that package set internally and recommend it to our users as their default choice, but ultimately you are free to compile your Haskell packages with any GHC version you please. The following command displays the complete list of available compilers: diff --git a/pkgs/development/compilers/ghc/8.10.2-binary.nix b/pkgs/development/compilers/ghc/8.10.2-binary.nix index baa1d879b53ec8..9ca121f2a80170 100644 --- a/pkgs/development/compilers/ghc/8.10.2-binary.nix +++ b/pkgs/development/compilers/ghc/8.10.2-binary.nix @@ -82,7 +82,6 @@ stdenv.mkDerivation rec { patchShebangs ghc-${version}/utils/ patchShebangs ghc-${version}/configure '' + - # We have to patch the GMP paths for the integer-gmp package. '' find . -name integer-gmp.buildinfo \ @@ -90,6 +89,9 @@ stdenv.mkDerivation rec { '' + stdenv.lib.optionalString stdenv.isDarwin '' find . -name base.buildinfo \ -exec sed -i "s@extra-lib-dirs: @extra-lib-dirs: ${libiconv}/lib@" {} \; + '' + stdenv.lib.optionalString stdenv.hostPlatform.isAarch64 '' + find . -name package.conf.in \ + -exec sed -i "s@FFI_LIB_DIR@FFI_LIB_DIR ${numactl.out}/lib@g" {} \; '' + # Rename needed libraries and binaries, fix interpreter stdenv.lib.optionalString stdenv.isLinux '' @@ -128,14 +130,33 @@ stdenv.mkDerivation rec { # On Linux, use patchelf to modify the executables so that they can # find editline/gmp. - postFixup = stdenv.lib.optionalString stdenv.isLinux '' - for p in $(find "$out" -type f -executable); do - if isELF "$p"; then - echo "Patchelfing $p" - patchelf --set-rpath "${libPath}:$(patchelf --print-rpath $p)" $p - fi - done - '' + stdenv.lib.optionalString stdenv.isDarwin '' + postFixup = stdenv.lib.optionalString stdenv.isLinux + (if stdenv.hostPlatform.isAarch64 then + # Keep rpath as small as possible on aarch64 for patchelf#244 + '' + (cd $out/lib; ln -s ${ncurses6.out}/lib/libtinfo.so.6) + (cd $out/lib; ln -s ${gmp.out}/lib/libgmp.so.10) + (cd $out/lib; ln -s ${numactl.out}/lib/libnuma.so.1) + for p in $(find "$out/lib" -type f -name "*\.so*"); do + (cd $out/lib; ln -s $p) + done + + for p in $(find "$out/lib" -type f -executable); do + if isELF "$p"; then + echo "Patchelfing $p" + patchelf --set-rpath "\$ORIGIN:\$ORIGIN/../.." $p + fi + done + '' + else + '' + for p in $(find "$out" -type f -executable); do + if isELF "$p"; then + echo "Patchelfing $p" + patchelf --set-rpath "${libPath}:$(patchelf --print-rpath $p)" $p + fi + done + '') + stdenv.lib.optionalString stdenv.isDarwin '' # not enough room in the object files for the full path to libiconv :( for exe in $(find "$out" -type f -executable); do isScript $exe && continue @@ -169,6 +190,11 @@ stdenv.mkDerivation rec { enableShared = true; }; - meta.license = stdenv.lib.licenses.bsd3; - meta.platforms = ["x86_64-linux" "armv7l-linux" "aarch64-linux" "i686-linux" "x86_64-darwin"]; + meta = { + homepage = "http://haskell.org/ghc"; + description = "The Glasgow Haskell Compiler"; + license = stdenv.lib.licenses.bsd3; + platforms = ["x86_64-linux" "armv7l-linux" "aarch64-linux" "i686-linux" "x86_64-darwin"]; + maintainers = with stdenv.lib.maintainers; [ lostnet ]; + }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 2b9a206e180337..504c72c1399f11 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9008,7 +9008,10 @@ in # Please update doc/languages-frameworks/haskell.section.md, “Our # current default compiler is”, if you bump this: - haskellPackages = dontRecurseIntoAttrs haskell.packages.ghc884; + haskellPackages = if stdenv.isAarch64 then + dontRecurseIntoAttrs haskell.packages.ghc8102 + else + dontRecurseIntoAttrs haskell.packages.ghc884; inherit (haskellPackages) ghc; diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index 693f8fe8276b0a..1a2b8fbc0667d5 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -85,7 +85,7 @@ in { llvmPackages = pkgs.llvmPackages_9; }; ghc8102 = callPackage ../development/compilers/ghc/8.10.2.nix { - bootPkgs = packages.ghc865Binary; + bootPkgs = packages.ghc8102Binary; inherit (buildPackages.python3Packages) sphinx; buildLlvmPackages = buildPackages.llvmPackages_9; llvmPackages = pkgs.llvmPackages_9;