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
5 changes: 1 addition & 4 deletions build.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,9 @@ in rec {
} // pkgs.lib.optionalAttrs (__compareVersions haskell.compiler.${compiler-nix-name}.version "9.6" < 0) {
stack =
tool compiler-nix-name "stack" {
cabalProjectLocal = ''
constraints: optparse-applicative <0.18
'';
version =
if __compareVersions haskell.compiler.${compiler-nix-name}.version "9.2" < 0
then "2.9.3"
then "2.9.3.1"
else "2.11.1";
inherit evalPackages;
};
Expand Down
16 changes: 3 additions & 13 deletions lib/call-cabal-project-to-nix.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
{ pkgs, runCommand, cacert, index-state-hashes, haskellLib }@defaults:
let readIfExists = src: fileName:
# Using origSrcSubDir bypasses any cleanSourceWith.
# `lookForCabalProject` allows us to avoid looking in source from hackage
# for cabal.project files. It is set in `modules/hackage-project.nix`.
let origSrcDir = src.origSrcSubDir or src;
in
if (src.lookForCabalProject or true) && builtins.elem ((__readDir origSrcDir)."${fileName}" or "") ["regular" "symlink"]
then __readFile (origSrcDir + "/${fileName}")
else null;
in
{ name ? src.name or null # optional name for better error messages
, src
, materialized-dir ? ../materialized
Expand All @@ -19,9 +9,9 @@ in
, materialized ? null # Location of a materialized copy of the nix files
, checkMaterialization ? null # If true the nix files will be generated used to check plan-sha256 and material
, cabalProjectFileName ? "cabal.project"
, cabalProject ? readIfExists src cabalProjectFileName
, cabalProjectLocal ? readIfExists src "${cabalProjectFileName}.local"
, cabalProjectFreeze ? readIfExists src "${cabalProjectFileName}.freeze"
, cabalProject ? null
, cabalProjectLocal ? null
, cabalProjectFreeze ? null
, caller ? "callCabalProjectToNix" # Name of the calling function for better warning messages
, compilerSelection ? p: p.haskell-nix.compiler
, ghc ? null # Deprecated in favour of `compiler-nix-name`
Expand Down
5 changes: 4 additions & 1 deletion modules/cabal-project.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
with lib;
with types;
let readIfExists = src: fileName:
# Using origSrcSubDir bypasses any cleanSourceWith.
# `lookForCabalProject` allows us to avoid looking in source from hackage
# for cabal.project files. It is set in `modules/hackage-project.nix`.
let origSrcDir = src.origSrcSubDir or src;
in
if builtins.elem ((__readDir origSrcDir)."${fileName}" or "") ["regular" "symlink"]
if (src.lookForCabalProject or true) && builtins.elem ((__readDir origSrcDir)."${fileName}" or "") ["regular" "symlink"]
then __readFile (origSrcDir + "/${fileName}")
else null;
in {
Expand Down
11 changes: 4 additions & 7 deletions modules/hackage-quirks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,13 @@ in [
}
)

# The latest version of stack (2.9.1) in hackage fails to build because the
# of version of rio-prettyprint (recently released 0.1.4.0) chosen by cabal.
# https://github.com/commercialhaskell/stack/issues/5963
# Avoid pantry 0.9 in versions without https://github.com/commercialhaskell/stack/pull/6187
# Also avoid optparse-applicative 0.18
({config, lib, pkgs, ...}:
{ _file = "haskell.nix/overlays/hackage-quirks.nix#stack"; } //
lib.mkIf (config.name == "stack" && builtins.compareVersions config.version "2.9.3" <= 0) {
lib.mkIf (config.name == "stack" && builtins.compareVersions config.version "2.11.1" <= 0) {
cabalProjectLocal = ''
constraints: unix-compat <0.7${
lib.optionalString (builtins.compareVersions config.version "2.9.1" <= 0)
" rio-prettyprint <0.1.4.0"}
constraints: pantry <0.9, optparse-applicative <0.18
'';
}
)
Expand Down