Skip to content

Commit

Permalink
Merge pull request #160733 from NixOS/haskell-updates
Browse files Browse the repository at this point in the history
haskellPackages.ghc: 8.10.7 -> 9.0.2
  • Loading branch information
maralorn authored Mar 30, 2022
2 parents 32e6148 + 7053070 commit 3bfa15f
Show file tree
Hide file tree
Showing 44 changed files with 12,366 additions and 13,618 deletions.
2 changes: 1 addition & 1 deletion lib/options.nix
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ rec {
Example:
mkPackageOption pkgs "GHC" {
default = [ "ghc" ];
example = "pkgs.haskell.package.ghc921.ghc.withPackages (hkgs: [ hkgs.primes ])";
example = "pkgs.haskell.package.ghc922.ghc.withPackages (hkgs: [ hkgs.primes ])";
}
=> { _type = "option"; default = «derivation /nix/store/jxx55cxsjrf8kyh3fp2ya17q99w7541r-ghc-8.10.7.drv»; defaultText = { ... }; description = "The GHC package to use."; example = { ... }; type = { ... }; }
*/
Expand Down
22 changes: 22 additions & 0 deletions maintainers/scripts/haskell/maintained-broken-pkgs.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
let
nixpkgs = import ../../..;
inherit (nixpkgs {}) haskellPackages lib;
maintainedPkgs = lib.filterAttrs (
_: v: builtins.length (v.meta.maintainers or []) > 0
) haskellPackages;
brokenPkgs = lib.filterAttrs (_: v: v.meta.broken) maintainedPkgs;
transitiveBrokenPkgs = lib.filterAttrs
(_: v: !(builtins.tryEval (v.outPath or null)).success && !v.meta.broken)
maintainedPkgs;
infoList = pkgs: lib.concatStringsSep "\n" (lib.mapAttrsToList (name: drv: "${name} ${(builtins.elemAt drv.meta.maintainers 0).github}") pkgs);
in {
report = ''
BROKEN:
${infoList brokenPkgs}
TRANSITIVE BROKEN:
${infoList transitiveBrokenPkgs}
'';
transitiveErrors =
builtins.attrValues transitiveBrokenPkgs;
}
37 changes: 25 additions & 12 deletions maintainers/scripts/haskell/update-stackage.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,38 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p nix curl jq nix-prefetch-github git gnused gnugrep -I nixpkgs=.
# shellcheck shell=bash

set -eu -o pipefail

tmpfile=$(mktemp "update-stackage.XXXXXXX")
# shellcheck disable=SC2064
# Stackage solver to use, LTS or Nightly
# (should be capitalized like the display name)
SOLVER=LTS
TMP_TEMPLATE=update-stackage.XXXXXXX
readonly SOLVER
readonly TMP_TEMPLATE

toLower() {
printf "%s" "$1" | tr '[:upper:]' '[:lower:]'
}

tmpfile=$(mktemp "$TMP_TEMPLATE")
tmpfile_new=$(mktemp "$TMP_TEMPLATE")

stackage_config="pkgs/development/haskell-modules/configuration-hackage2nix/stackage.yaml"

trap "rm ${tmpfile} ${tmpfile}.new" 0
touch "$tmpfile" "$tmpfile.new" # Creating files here so that trap creates no errors.
trap 'rm "${tmpfile}" "${tmpfile_new}"' 0
touch "$tmpfile" "$tmpfile_new" # Creating files here so that trap creates no errors.

curl -L -s "https://stackage.org/lts/cabal.config" >"$tmpfile"
old_version=$(grep "# Stackage" $stackage_config | sed -E 's/.*([0-9]{2}\.[0-9]+)/\1/')
version=$(sed -rn "s/^--.*http:..(www.)?stackage.org.snapshot.lts-//p" "$tmpfile")
curl -L -s "https://stackage.org/$(toLower "$SOLVER")/cabal.config" >"$tmpfile"
old_version=$(grep '^# Stackage' $stackage_config | sed -e 's/.\+ \([A-Za-z]\+ [0-9.-]\+\)$/\1/g')
version="$SOLVER $(sed -rn "s/^--.*http:..(www.)?stackage.org.snapshot.$(toLower "$SOLVER")-//p" "$tmpfile")"

if [[ "$old_version" == "$version" ]]; then
echo "No new stackage version"
exit 0 # Nothing to do
fi

echo "Updating Stackage LTS from $old_version to $version."
echo "Updating Stackage from $old_version to $version."

# Create a simple yaml version of the file.
sed -r \
Expand All @@ -30,10 +42,10 @@ sed -r \
-e 's|,$||' \
-e '/installed$/d' \
-e '/^$/d' \
< "${tmpfile}" | sort --ignore-case >"${tmpfile}.new"
< "${tmpfile}" | sort --ignore-case >"${tmpfile_new}"

cat > $stackage_config << EOF
# Stackage LTS $version
# Stackage $version
# This file is auto-generated by
# maintainers/scripts/haskell/update-stackage.sh
default-package-overrides:
Expand All @@ -45,12 +57,13 @@ sed -r \
-e '/ distribution-nixpkgs /d' \
-e '/ jailbreak-cabal /d' \
-e '/ language-nix /d' \
< "${tmpfile}.new" >> $stackage_config
-e '/ cabal-install /d' \
< "${tmpfile_new}" >> $stackage_config

if [[ "${1:-}" == "--do-commit" ]]; then
git add $stackage_config
git commit -F - << EOF
haskellPackages: stackage-lts $old_version -> $version
haskellPackages: stackage $old_version -> $version
This commit has been generated by maintainers/scripts/haskell/update-stackage.sh
EOF
Expand Down
4 changes: 2 additions & 2 deletions nixos/doc/manual/development/option-declarations.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ lib.mkOption {
```nix
lib.mkPackageOption pkgs "GHC" {
default = [ "ghc" ];
example = "pkgs.haskell.package.ghc921.ghc.withPackages (hkgs: [ hkgs.primes ])";
example = "pkgs.haskell.package.ghc922.ghc.withPackages (hkgs: [ hkgs.primes ])";
}
# is like
lib.mkOption {
type = lib.types.package;
default = pkgs.ghc;
defaultText = lib.literalExpression "pkgs.ghc";
example = lib.literalExpression "pkgs.haskell.package.ghc921.ghc.withPackages (hkgs: [ hkgs.primes ])";
example = lib.literalExpression "pkgs.haskell.package.ghc922.ghc.withPackages (hkgs: [ hkgs.primes ])";
description = "The GHC package to use.";
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,14 @@ lib.mkOption {
<programlisting language="bash">
lib.mkPackageOption pkgs &quot;GHC&quot; {
default = [ &quot;ghc&quot; ];
example = &quot;pkgs.haskell.package.ghc921.ghc.withPackages (hkgs: [ hkgs.primes ])&quot;;
example = &quot;pkgs.haskell.package.ghc922.ghc.withPackages (hkgs: [ hkgs.primes ])&quot;;
}
# is like
lib.mkOption {
type = lib.types.package;
default = pkgs.ghc;
defaultText = lib.literalExpression &quot;pkgs.ghc&quot;;
example = lib.literalExpression &quot;pkgs.haskell.package.ghc921.ghc.withPackages (hkgs: [ hkgs.primes ])&quot;;
example = lib.literalExpression &quot;pkgs.haskell.package.ghc922.ghc.withPackages (hkgs: [ hkgs.primes ])&quot;;
description = &quot;The GHC package to use.&quot;;
}
</programlisting>
Expand Down
8 changes: 8 additions & 0 deletions nixos/doc/manual/from_md/release-notes/rl-2205.section.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@
and their users.
</para>
</listitem>
<listitem>
<para>
The default GHC version has been updated from 8.10.7 to 9.0.2.
<literal>pkgs.haskellPackages</literal> and
<literal>pkgs.ghc</literal> will now use this version by
default.
</para>
</listitem>
</itemizedlist>
</section>
<section xml:id="sec-release-22.05-new-services">
Expand Down
2 changes: 2 additions & 0 deletions nixos/doc/manual/release-notes/rl-2205.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ In addition to numerous new and upgraded packages, this release has the followin

- Module authors can use `mkRenamedOptionModuleWith` to automate the deprecation cycle without annoying out-of-tree module authors and their users.

- The default GHC version has been updated from 8.10.7 to 9.0.2. `pkgs.haskellPackages` and `pkgs.ghc` will now use this version by default.

## New Services {#sec-release-22.05-new-services}

- [aesmd](https://github.com/intel/linux-sgx#install-the-intelr-sgx-psw), the Intel SGX Architectural Enclave Service Manager. Available as [services.aesmd](#opt-services.aesmd.enable).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
{lib, stdenvNoCC, haskellPackages, fetchurl, writers}:

let
hledger-lib = haskellPackages.hledger-lib_1_24_1;
in

stdenvNoCC.mkDerivation rec {
pname = "hledger-check-fancyassertions";
inherit (hledger-lib) version;
inherit (haskellPackages.hledger-lib) version;

src = fetchurl {
name = "hledger-check-fancyassertion-${version}.hs";
url = "https://raw.githubusercontent.com/simonmichael/hledger/hledger-lib-${version}/bin/hledger-check-fancyassertions.hs";
sha256 = "0naggvivc6szsc8haa52a6lm079ikz5qfva0ljnqx0f1zlkxv984";
sha256 = "1xy3ssxnwybq40nlffz95w7m9xbzf8ysb13svg0i8g5sfgrw11vk";
};

dontUnpack = true;
Expand All @@ -20,13 +16,12 @@ stdenvNoCC.mkDerivation rec {
executable = writers.writeHaskell
"hledger-check-fancyassertions"
{
libraries = [
libraries = with haskellPackages; [
hledger-lib
] ++ (with haskellPackages; [
base base-compat base-compat-batteries filepath
megaparsec microlens optparse-applicative string-qq text time
transformers
]);
];
inherit (haskellPackages) ghc;
}
src;
Expand Down
12 changes: 7 additions & 5 deletions pkgs/applications/virtualization/arion/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,16 @@ let
- make it self-contained by including docker-compose
*/
arion =
justStaticExecutables (
(justStaticExecutables (
overrideCabal
cabalOverrides
arion-compose
);
)
).overrideAttrs (o: {
# Patch away the arion-compose name. Unlike the Haskell library, the program
# is called arion (arion was already taken on hackage).
pname = "arion";
});

inherit (haskell.lib.compose) justStaticExecutables overrideCabal;

Expand All @@ -31,9 +36,6 @@ let
passthru = (o.passthru or {}) // {
inherit eval build;
};
# Patch away the arion-compose name. Unlike the Haskell library, the program
# is called arion (arion was already taken on hackage).
pname = "arion";
src = arion-compose.src;

# PYTHONPATH
Expand Down
8 changes: 4 additions & 4 deletions pkgs/data/misc/hackage/pin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"commit": "aa8f2230d08c540df249147ea681a5c22314d083",
"url": "https://github.com/commercialhaskell/all-cabal-hashes/archive/aa8f2230d08c540df249147ea681a5c22314d083.tar.gz",
"sha256": "1h92r4si1vmf3v2m843xaqwr99hpnn1s0x08qcvd2gwjkc2qq10a",
"msg": "Update from Hackage at 2022-02-14T17:17:31Z"
"commit": "f504760b580057f368d85ed6f6c4e78a38968ff4",
"url": "https://github.com/commercialhaskell/all-cabal-hashes/archive/f504760b580057f368d85ed6f6c4e78a38968ff4.tar.gz",
"sha256": "0m3w7bawx0qxj2qn3yx1d4j90dq89k5c4604f6z38cxxx0rszmzj",
"msg": "Update from Hackage at 2022-03-26T03:24:04Z"
}
6 changes: 6 additions & 0 deletions pkgs/development/compilers/carp/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ haskellPackages.mkDerivation rec {
sha256 = "sha256-o7NLd7jC1BvcoVzbD18LvHg/SqOnfn9yELUrpg2uZtY=";
};

# -Werror breaks build with GHC >= 9.0
# https://github.com/carp-lang/Carp/issues/1386
postPatch = ''
substituteInPlace CarpHask.cabal --replace "-Werror" ""
'';

buildTools = [ makeWrapper ];

executableHaskellDepends = with haskellPackages; [
Expand Down
3 changes: 3 additions & 0 deletions pkgs/development/compilers/elm/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ let
in elmPkgs // {
inherit elmPkgs;

# We need attoparsec < 0.14 to build elm for now
attoparsec = self.attoparsec_0_13_2_5;

# Needed for elm-format
indents = self.callPackage ./packages/indents.nix {};
bimap = self.callPackage ./packages/bimap.nix {};
Expand Down
4 changes: 4 additions & 0 deletions pkgs/development/compilers/ghc/8.10.7.nix
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,10 @@ stdenv.mkDerivation (rec {
inherit llvmPackages;
inherit enableShared;

# This is used by the haskell builder to query
# the presence of the haddock program.
hasHaddock = enableHaddockProgram;

# Our Cabal compiler name
haskellCompilerName = "ghc-${version}";
};
Expand Down
4 changes: 4 additions & 0 deletions pkgs/development/compilers/ghc/8.8.4.nix
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,10 @@ stdenv.mkDerivation (rec {
inherit llvmPackages;
inherit enableShared;

# This is used by the haskell builder to query
# the presence of the haddock program.
hasHaddock = enableHaddockProgram;

# Our Cabal compiler name
haskellCompilerName = "ghc-${version}";
};
Expand Down
16 changes: 12 additions & 4 deletions pkgs/development/compilers/ghc/9.0.2.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

, # Whether to build dynamic libs for the standard library (on the target
# platform). Static libs are always built.
enableShared ? !stdenv.targetPlatform.isWindows && !stdenv.targetPlatform.useiOSPrebuilt
enableShared ? with stdenv.targetPlatform; !isWindows && !useiOSPrebuilt && !isStatic

, # Whether to build terminfo.
enableTerminfo ? !stdenv.targetPlatform.isWindows
Expand Down Expand Up @@ -105,9 +105,13 @@ let
CrossCompilePrefix = ${targetPrefix}
'' + lib.optionalString (!enableProfiledLibs) ''
GhcLibWays = "v dyn"
'' + lib.optionalString enableRelocatedStaticLibs ''
GhcLibHcOpts += -fPIC
GhcRtsHcOpts += -fPIC
'' +
# -fexternal-dynamic-refs apparently (because it's not clear from the documentation)
# makes the GHC RTS able to load static libraries, which may be needed for TemplateHaskell.
# This solution was described in https://www.tweag.io/blog/2020-09-30-bazel-static-haskell
lib.optionalString enableRelocatedStaticLibs ''
GhcLibHcOpts += -fPIC -fexternal-dynamic-refs
GhcRtsHcOpts += -fPIC -fexternal-dynamic-refs
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
EXTRA_CC_OPTS += -std=gnu99
'';
Expand Down Expand Up @@ -327,6 +331,10 @@ stdenv.mkDerivation (rec {
inherit llvmPackages;
inherit enableShared;

# This is used by the haskell builder to query
# the presence of the haddock program.
hasHaddock = enableHaddockProgram;

# Our Cabal compiler name
haskellCompilerName = "ghc-${version}";
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

, # Whether to build dynamic libs for the standard library (on the target
# platform). Static libs are always built.
enableShared ? !stdenv.targetPlatform.isWindows && !stdenv.targetPlatform.useiOSPrebuilt
enableShared ? with stdenv.targetPlatform; !isWindows && !useiOSPrebuilt && !isStatic

, # Whether to build terminfo.
enableTerminfo ? !stdenv.targetPlatform.isWindows
Expand Down Expand Up @@ -106,9 +106,13 @@ let
CrossCompilePrefix = ${targetPrefix}
'' + lib.optionalString (!enableProfiledLibs) ''
GhcLibWays = "v dyn"
'' + lib.optionalString enableRelocatedStaticLibs ''
GhcLibHcOpts += -fPIC
GhcRtsHcOpts += -fPIC
'' +
# -fexternal-dynamic-refs apparently (because it's not clear from the documentation)
# makes the GHC RTS able to load static libraries, which may be needed for TemplateHaskell.
# This solution was described in https://www.tweag.io/blog/2020-09-30-bazel-static-haskell
lib.optionalString enableRelocatedStaticLibs ''
GhcLibHcOpts += -fPIC -fexternal-dynamic-refs
GhcRtsHcOpts += -fPIC -fexternal-dynamic-refs
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
EXTRA_CC_OPTS += -std=gnu99
'';
Expand Down Expand Up @@ -167,12 +171,12 @@ assert buildTargetLlvmPackages.llvm == llvmPackages.llvm;
assert stdenv.targetPlatform.isDarwin -> buildTargetLlvmPackages.clang == llvmPackages.clang;

stdenv.mkDerivation (rec {
version = "9.2.1";
version = "9.2.2";
pname = "${targetPrefix}ghc${variantSuffix}";

src = fetchurl {
url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-src.tar.xz";
sha256 = "f444012f97a136d9940f77cdff03fda48f9475e2ed0fec966c4d35c4df55f746";
sha256 = "902463a4cc6ee479af9358b9f8b2ee3237b03e934a1ea65b6d1fcf3e0d749ea6";
};

enableParallelBuilding = true;
Expand Down Expand Up @@ -221,6 +225,9 @@ stdenv.mkDerivation (rec {
export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}"
'' + lib.optionalString stdenv.isDarwin ''
export NIX_LDFLAGS+=" -no_dtrace_dof"
# GHC tries the host xattr /usr/bin/xattr by default which fails since it expects python to be 2.7
export XATTR=${lib.getBin xattr}/bin/xattr
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
sed -i -e '5i ,("armv7a-unknown-linux-androideabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "cortex-a8", ""))' llvm-targets
'' + lib.optionalString targetPlatform.isMusl ''
Expand Down Expand Up @@ -282,10 +289,6 @@ stdenv.mkDerivation (rec {
autoSignDarwinBinariesHook
] ++ lib.optionals enableDocs [
sphinx
] ++ lib.optionals stdenv.isDarwin [
# TODO(@sternenseemann): backport addition of XATTR env var like
# https://gitlab.haskell.org/ghc/ghc/-/merge_requests/6447
xattr
];

# For building runtime libs
Expand Down Expand Up @@ -328,6 +331,10 @@ stdenv.mkDerivation (rec {
inherit llvmPackages;
inherit enableShared;

# This is used by the haskell builder to query
# the presence of the haddock program.
hasHaddock = enableHaddockProgram;

# Our Cabal compiler name
haskellCompilerName = "ghc-${version}";
};
Expand Down
Loading

0 comments on commit 3bfa15f

Please sign in to comment.