diff --git a/nix/haskell-parsers/default.nix b/nix/haskell-parsers/default.nix index f81521c6..b28042a0 100644 --- a/nix/haskell-parsers/default.nix +++ b/nix/haskell-parsers/default.nix @@ -1,6 +1,7 @@ { pkgs , lib , throwError ? builtins.throw +, throwErrorOnCabalProjectParseError ? builtins.throw , ... }: @@ -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 diff --git a/nix/modules/project/defaults.nix b/nix/modules/project/defaults.nix index 512244a7..8957873a 100644 --- a/nix/modules/project/defaults.nix +++ b/nix/modules/project/defaults.nix @@ -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