Skip to content

Commit

Permalink
chore: only mention cabal.project issue for parser errors
Browse files Browse the repository at this point in the history
  • Loading branch information
srid committed Apr 22, 2024
1 parent f2153d0 commit 462f004
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 4 additions & 3 deletions nix/haskell-parsers/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{ pkgs
, lib
, throwError ? builtins.throw
, throwErrorOnCabalProjectParseError ? builtins.throw
, ...
}:

Expand Down Expand Up @@ -49,13 +50,13 @@ in
if isSelfPath path
then projectRoot
else if lib.strings.hasInfix "*" path
then throwError "Found a path with glob (${path}) in ${cabalProjectFile}, which is not supported"
then throwErrorOnCabalProjectParseError "Found a path with glob (${path}) in ${cabalProjectFile}, which is not supported"
else if lib.strings.hasSuffix ".cabal" path
then throwError "Expected a directory but ${path} (in ${cabalProjectFile}) is a .cabal filepath"
then throwErrorOnCabalProjectParseError "Expected a directory but ${path} (in ${cabalProjectFile}) is a .cabal filepath"
else "${projectRoot}/${path}"
)
res.value
else throwError "Failed to parse ${cabalProjectFile}: ${builtins.toJSON res}"
else throwErrorOnCabalProjectParseError "Failed to parse ${cabalProjectFile}: ${builtins.toJSON res}"
else
[ projectRoot ];
in
Expand Down
6 changes: 6 additions & 0 deletions nix/modules/project/defaults.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ in
A default value for `packages` cannot be auto-determined:
${msg}
'';
throwErrorOnCabalProjectParseError = msg: config.log.throwError ''
A default value for `packages` cannot be auto-determined:
${msg}
haskell-flake's `cabal.project` parser is limited; see #307.
Please specify the `packages` option manually or modify your
Expand Down

0 comments on commit 462f004

Please sign in to comment.