Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 5 additions & 0 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions cabal2nix/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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).
Expand Down
2 changes: 1 addition & 1 deletion cabal2nix/cabal2nix.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ author: Peter Simons <simons@cryp.to>
-- list all contributors: git log --pretty='%an' | sort | uniq
maintainer: sternenseemann <sternenseemann@systemli.org>
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
Expand Down
11 changes: 10 additions & 1 deletion cabal2nix/test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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:
--
Expand Down
2 changes: 1 addition & 1 deletion distribution-nixpkgs/distribution-nixpkgs.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ license: BSD3
license-file: LICENSE
author: Peter Simons <simons@cryp.to>
maintainer: sternenseemann <sternenseemann@systemli.org>
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
Expand Down
2 changes: 1 addition & 1 deletion hackage-db/hackage-db.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license: BSD3
license-file: LICENSE
author: Peter Simons, Alexander Altman, Ben James, Kevin Quick
maintainer: sternenseemann <sternenseemann@systemli.org>
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
Expand Down
2 changes: 1 addition & 1 deletion language-nix/language-nix.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
40 changes: 35 additions & 5 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,41 @@
{ pkgs ? import <nixpkgs> { }
{ 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
Expand All @@ -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.
Expand Down
Loading