Skip to content

Creating projects without local packages #6144

@bgamari

Description

@bgamari

Describe the bug
Currently cabal-install expects projects to have at least one local package listed in cabal.project. However, there are use-cases where one might want a project without any local packages (e.g. to create an environment for using a project-specific repository, e.g. to build a package from head.hackage with cabal new-install).

To Reproduce

$ cat >cabal.project <<EOF
repository head.hackage.ghc.haskell.org
   url: https://ghc.gitlab.haskell.org/head.hackage/
   secure: True
   key-threshold: 3
   root-keys:
       7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d
       26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329
       f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89
$ cabal v2-install --lib aeson
cabal: There is no <pkgname>.cabal package file or cabal.project file. To
build packages locally you need at minimum a <pkgname>.cabal file. You can use
'cabal init' to create one.

For non-trivial projects you will also want a cabal.project file in the root
directory of your project. This file lists the packages in your project and
all other build configuration. See the Cabal user guide for full details.

Expected behavior

cabal new-install would build aeson.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions