diff --git a/.envrc b/.envrc index 5426c018..f2f9cee6 100644 --- a/.envrc +++ b/.envrc @@ -3,5 +3,5 @@ if type -p lorri; then eval "$(lorri direnv)" else echo "direnv: using direnv nix support" 1>&2 - use nix; + use nix --arg minimal true --arg withHls true; fi diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 18c51ebb..8011a79b 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -32,6 +32,11 @@ jobs: strategy: matrix: include: + - compiler: ghc-9.12.2 + compilerKind: ghc + compilerVersion: 9.12.2 + setup-method: ghcup + allow-failure: false - compiler: ghc-9.10.1 compilerKind: ghc compilerVersion: 9.10.1 diff --git a/cabal2nix/CHANGELOG.md b/cabal2nix/CHANGELOG.md index d21474dc..bd2d3714 100644 --- a/cabal2nix/CHANGELOG.md +++ b/cabal2nix/CHANGELOG.md @@ -1,5 +1,9 @@ # Revision History for cabal2nix +## Unreleased + +- Add support for Cabal `== 3.14.*` in the test suite. + ## 2.20.0 * `cabal2nix` now [prints the commands it runs when fetching sources](https://github.com/nixOS/cabal2nix/commit/5327953d299eba0b6de4e88bacf4bba9022bb5e2). diff --git a/cabal2nix/cabal2nix.cabal b/cabal2nix/cabal2nix.cabal index 3947b13a..d2d16536 100644 --- a/cabal2nix/cabal2nix.cabal +++ b/cabal2nix/cabal2nix.cabal @@ -12,7 +12,7 @@ author: Peter Simons -- list all contributors: git log --pretty='%an' | sort | uniq maintainer: sternenseemann stability: stable -tested-with: GHC == 8.10.7 || == 9.0.2 || == 9.2.8 || == 9.4.8 || == 9.6.7 || == 9.8.4 || == 9.10.1 +tested-with: GHC == 8.10.7 || == 9.0.2 || == 9.2.8 || == 9.4.8 || == 9.6.7 || == 9.8.4 || == 9.10.1 || == 9.12.2 category: Distribution, Nix homepage: https://github.com/nixos/cabal2nix#readme bug-reports: https://github.com/nixos/cabal2nix/issues diff --git a/cabal2nix/test/Main.hs b/cabal2nix/test/Main.hs index d4a6e4e9..5201c5cd 100644 --- a/cabal2nix/test/Main.hs +++ b/cabal2nix/test/Main.hs @@ -22,6 +22,9 @@ import Distribution.PackageDescription import Distribution.PackageDescription.Parsec #endif import Distribution.System +#if MIN_VERSION_Cabal(3,14,0) +import Distribution.Utils.Path (makeSymbolicPath) +#endif import Distribution.Verbosity import Distribution.Version import Language.Nix @@ -38,6 +41,7 @@ main = do -- depend on the system environment: https://github.com/NixOS/cabal2nix/issues/333. -- -- TODO: Run this test without $HOME defined to ensure that we don't need that variable. + -- TODO: make test suite independent of working directory somehow cabal2nix <- findExecutable "cabal2nix" >>= \case Nothing -> fail "cannot find 'cabal2nix' in $PATH" Just exe -> pure exe @@ -74,7 +78,12 @@ testLibrary cabalFile = do (\ref new -> ["diff", "-u", ref, new]) goldenFile nixFile - (readGenericPackageDescription silent cabalFile >>= writeFileLn nixFile . prettyShow . cabal2nix) +#if MIN_VERSION_Cabal(3,14,0) + (readGenericPackageDescription silent Nothing (makeSymbolicPath cabalFile) +#else + (readGenericPackageDescription silent cabalFile +#endif + >>= writeFileLn nixFile . prettyShow . cabal2nix) -- | TODO: -- diff --git a/distribution-nixpkgs/distribution-nixpkgs.cabal b/distribution-nixpkgs/distribution-nixpkgs.cabal index 32469368..5697f721 100644 --- a/distribution-nixpkgs/distribution-nixpkgs.cabal +++ b/distribution-nixpkgs/distribution-nixpkgs.cabal @@ -6,7 +6,7 @@ license: BSD3 license-file: LICENSE author: Peter Simons maintainer: sternenseemann -tested-with: GHC == 8.10.7 || == 9.0.2 || == 9.2.8 || == 9.4.8 || == 9.6.7 || == 9.8.4 || == 9.10.1 +tested-with: GHC == 8.10.7 || == 9.0.2 || == 9.2.8 || == 9.4.8 || == 9.6.7 || == 9.8.4 || == 9.10.1 || == 9.12.2 category: Distribution, Nix homepage: https://github.com/NixOS/cabal2nix/tree/master/distribution-nixpkgs#readme bug-reports: https://github.com/NixOS/cabal2nix/issues diff --git a/hackage-db/hackage-db.cabal b/hackage-db/hackage-db.cabal index 241c1438..30c64335 100644 --- a/hackage-db/hackage-db.cabal +++ b/hackage-db/hackage-db.cabal @@ -9,7 +9,7 @@ license: BSD3 license-file: LICENSE author: Peter Simons, Alexander Altman, Ben James, Kevin Quick maintainer: sternenseemann -tested-with: GHC == 8.10.7 || == 9.0.2 || == 9.2.8 || == 9.4.8 || == 9.6.7 || == 9.8.4 || == 9.10.1 +tested-with: GHC == 8.10.7 || == 9.0.2 || == 9.2.8 || == 9.4.8 || == 9.6.7 || == 9.8.4 || == 9.10.1 || == 9.12.2 category: Distribution homepage: https://github.com/NixOS/cabal2nix/tree/master/hackage-db#readme bug-reports: https://github.com/NixOS/cabal2nix/issues diff --git a/language-nix/language-nix.cabal b/language-nix/language-nix.cabal index 61074b9e..6d2edbe3 100644 --- a/language-nix/language-nix.cabal +++ b/language-nix/language-nix.cabal @@ -7,7 +7,7 @@ license: BSD3 license-file: LICENSE author: Peter Simons maintainer: simons@cryp.to -tested-with: GHC == 8.10.7, GHC == 9.0.2, GHC == 9.2.8, GHC == 9.4.8, GHC == 9.6.7 || == 9.8.4 || == 9.10.1 +tested-with: GHC == 8.10.7, GHC == 9.0.2, GHC == 9.2.8, GHC == 9.4.8, GHC == 9.6.7 || == 9.8.4 || == 9.10.1 || == 9.12.2 category: Distribution, Language, Nix homepage: https://github.com/NixOS/cabal2nix/tree/master/language-nix#readme bug-reports: https://github.com/NixOS/cabal2nix/issues diff --git a/shell.nix b/shell.nix index 04f9c57f..25837083 100644 --- a/shell.nix +++ b/shell.nix @@ -1,12 +1,41 @@ -{ pkgs ? import { } +{ pkgs ? + import (builtins.fetchTarball { + # nixos-unstable 2025-04-23 + url = "https://github.com/nixos/nixpkgs/archive/96d30055a2215e5c5a545872376137a5d063e804.tar.gz"; + sha256 = "0xvzkpgc8qy4q252c3x399c8ikrks970c877s4i7vppnhxp08p8n"; + }) { } , ghcVersion ? pkgs.haskellPackages.ghc.version -, withHls ? true + # Pass --arg minimal true to disable tools that are not strictly necessary + # and may break when using non default GHC versions / other Nixpkgs revisions. +, minimal ? false +, withHls ? !minimal }: let haskellPackages = pkgs.haskell.packages."ghc${ builtins.replaceStrings [ "." ] [ "" ] ghcVersion }"; + inherit (pkgs) lib; + haskellLib = pkgs.haskell.lib.compose; + + haskell-ci-pinned = lib.pipe + pkgs.haskell.packages.ghc9101.haskell-ci # compatible Cabal version by default + [ + (haskellLib.overrideSrc { + version = "0-unstable-2025-03-30"; + src = pkgs.fetchFromGitHub rec { + name = "haskell-ci-source-${lib.substring 0 7 rev}"; + owner = "haskell-CI"; + repo = "haskell-ci"; + rev = "f0fd898ab14070fa46e9fd542a2b487a8146d88e"; + sha256 = "1pzrnpwsamy8ld6gb7vf9acr873z5q35pixbkwxvji5y9si0x352"; + }; + }) + # Make the build a bit less expensive + haskellLib.dontCheck + haskellLib.disableLibraryProfiling + ]; + ghc = haskellPackages.ghcWithHoogle (hps: [ hps.ansi-wl-pprint hps.hopenssl @@ -30,12 +59,13 @@ in pkgs.mkShell { packages = [ ghc pkgs.cabal-install - pkgs.haskell-ci - (pkgs.lib.getLib pkgs.openssl) + (lib.getLib pkgs.openssl) # Needed to run `cabal2nix`: pkgs.nix-prefetch-scripts - ] ++ pkgs.lib.optionals withHls [ + ] ++ lib.optionals withHls [ haskellPackages.haskell-language-server + ] ++ lib.optionals (!minimal) [ + haskell-ci-pinned ]; # Make Paths_ module of distribution-nixpkgs find its data files in the shell.