Skip to content

Commit

Permalink
Upgrade GHC to v9.6, and nixpkgs for good measure.
Browse files Browse the repository at this point in the history
The modification to `tar` has been released, so we can use that version
now instead of a random commit.

Some types and functions in Aeson have been deprecated and moved.

We no longer need to patch Ormolu in nixpkgs, as the fix has been merged.

This also brings along an upgrade to Ruby, resulting in changes to error
message syntax, which means a change to a fixture.
  • Loading branch information
SamirTalwar committed Sep 24, 2024
1 parent dd1bf1c commit e08d363
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 85 deletions.
5 changes: 5 additions & 0 deletions fixtures/calculator/smoke.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ tests:
fixtures/calculator.rb:4:in `<main>': undefined method `to-the-power-of' for 3:Fixnum (NoMethodError)
- |
fixtures/calculator.rb:4:in `<main>': undefined method `to-the-power-of' for 3:Integer (NoMethodError)
- |
fixtures/calculator.rb:4:in `<main>': undefined method `to-the-power-of' for an instance of Integer (NoMethodError)
puts tokens[0].to_i.send(tokens[1].to_sym, tokens[2].to_i)
^^^^^
- name: ignored-test
ignored: true
Expand Down
56 changes: 28 additions & 28 deletions flake.lock

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

44 changes: 8 additions & 36 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,23 @@
description = "Smoke";

inputs = {
flake-compat.url = github:edolstra/flake-compat;
flake-compat.url = "github:edolstra/flake-compat";
flake-compat.flake = false;
flake-utils.url = github:numtide/flake-utils;
nixpkgs.url = github:NixOS/nixpkgs/master;
haskellTar.url = github:haskell/tar/dbf8c995153c8a80450724d9f94cf33403740c80;
haskellTar.flake = false;
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};

outputs =
{ self
, flake-compat
, flake-utils
, nixpkgs
, haskellTar
}:
flake-utils.lib.eachDefaultSystem (system:
let
ghcVersion = lib.strings.fileContents ./ghc.version;
ghcName = "ghc" + lib.strings.stringAsChars (c: if c == "." then "" else c) ghcVersion;
pkgs = import nixpkgs {
inherit system;
overlays = [
(self: super: {
haskell = super.haskell // {
packages = super.haskell.packages // {
# haskell package set from the version of GHC specified by `./ghc.version`
${ghcName} = super.haskell.packages.${ghcName}.override {
overrides = hself: hsuper: {
# Override tar with the patched version; see stack.yaml for details.
# The tests don't work.
tar = hsuper.callCabal2nixWithOptions "tar" haskellTar "--no-check" { };
} // (if super.stdenv.targetPlatform.isDarwin
then
# macOS-specific overrides:
{
# On aarch64-darwin, this creates a cycle.
# see https://github.com/NixOS/nixpkgs/issues/140774
ormolu = super.haskell.lib.overrideCabal hsuper.ormolu (drv: { enableSeparateBinOutput = false; });
}
else
# We don't need to override anything on Linux:
{ });
};
};
};
})
];
};
pkgs = import nixpkgs { inherit system; };

inherit (pkgs) lib haskell;
inherit (haskell.lib) overrideCabal justStaticExecutables doStrip;
Expand All @@ -66,7 +35,10 @@

smoke =
let
drv = hsPkgs.callCabal2nix "smoke" (pkgs.nix-gitignore.gitignoreSource [ ] ./.) { };
drv = hsPkgs.callCabal2nix "smoke" (pkgs.nix-gitignore.gitignoreSource [ ] ./.) {
# Override tar with the patched version; see stack.yaml for details.
tar = hsPkgs.tar_0_6_3_0;
};
in
haskell.lib.addExtraLibraries drv staticLibs;
in
Expand Down
2 changes: 1 addition & 1 deletion ghc.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9.2.6
9.6.6
8 changes: 4 additions & 4 deletions src/lib/Test/Smoke/Discovery.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Control.Monad (forM, unless)
import Control.Monad.IO.Class (liftIO)
import Control.Monad.Trans.Except (ExceptT (..), except, throwE, withExceptT)
import Data.Aeson qualified as Aeson
import Data.Aeson.Internal qualified as Aeson.Internal
import Data.Aeson.Types qualified as Aeson.Types
import Data.List qualified as List
import Data.Text qualified as Text
import Data.Vector (Vector)
Expand Down Expand Up @@ -75,9 +75,9 @@ decodeSpecificationFile path = withExceptT (InvalidSpecification path) $ do
withExceptT Yaml.prettyPrintParseException $
ExceptT $
Yaml.decodeFileEither (toFilePath resolvedPath)
except $ case Aeson.Internal.ifromJSON value of
Aeson.Internal.IError jsonPath message -> Left $ Aeson.Internal.formatError jsonPath message
Aeson.Internal.ISuccess suite -> Right suite
except $ case Aeson.Types.ifromJSON value of
Aeson.Types.IError jsonPath message -> Left $ Aeson.Types.formatError jsonPath message
Aeson.Types.ISuccess suite -> Right suite

parseRoot :: String -> Discovery Root
parseRoot location = do
Expand Down
7 changes: 3 additions & 4 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resolver: lts-20.12
resolver: lts-22.35
packages:
- .
ghc-options:
Expand All @@ -7,6 +7,5 @@ nix:
shell-file: ./shell.nix
extra-deps:
# There was a bug in the `tar` package that is fixed in https://github.com/haskell/tar/pull/26.
# However, this code has not been released, so we need to grab the latest commit instead.
- git: https://github.com/haskell/tar.git
commit: dbf8c995153c8a80450724d9f94cf33403740c80
# This has been released in tar v6.0.0.0 and up, but these versions are not in the current Stackage LTS (above).
- tar-0.6.3.0
20 changes: 8 additions & 12 deletions stack.yaml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,15 @@

packages:
- completed:
commit: dbf8c995153c8a80450724d9f94cf33403740c80
git: https://github.com/haskell/tar.git
name: tar
hackage: tar-0.6.3.0@sha256:e9f151d9999be8953443e730524b2792e9c0a4fb5b1463097fa1a8230870fd8a,4634
pantry-tree:
sha256: 1a97f1a4e4e2e86e338c2629c75af9efbb64eb087efcb6adce6c19f22bfd4de0
size: 1985
version: 0.6.0.0
sha256: e59e0d0224352033c32356d517f90d4c6a41cee4fa0d386885df146302d1ba3b
size: 2241
original:
commit: dbf8c995153c8a80450724d9f94cf33403740c80
git: https://github.com/haskell/tar.git
hackage: tar-0.6.3.0
snapshots:
- completed:
sha256: af5d667f6096e535b9c725a72cffe0f6c060e0568d9f9eeda04caee70d0d9d2d
size: 649133
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/20/12.yaml
original: lts-20.12
sha256: 31a722458578b1f709b6fe098d9027bbb5c04b4430e7338a5e69707bd3990e5d
size: 720019
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/22/35.yaml
original: lts-22.35

0 comments on commit e08d363

Please sign in to comment.