Search code examples
haskellcabal

Cabal fetch dependencies for current package


I wrote a package that I am trying to build. For reasons, I do not want to install it on my laptop. I want to download all of its dependencies and install it on another computer. How can I do that? If I run

$ cd my-package
$ cabal fetch .

cabal says no packages requested. If I do

$ cabal fetch my-package.cabal

it does read the cabal file, but then it actually tries to download packages that don't exist on hackage, but are in my sandbox.


Solution

  • You could try this:

    cabal fetch `cabal install --dependencies-only --dry-run | sed 1,2d`
    

    You might want to do it in a fresh sandbox so it doesn't skip dependencies that are already installed.

    Aren't *nix tools great?