Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cabal sandbox v. global package db

Tags:

haskell

ghc

cabal

When installing inside a cabal sandbox, cabal will still use packages from the global package db (in particular, packages which came from the Haskell Platform). This can lead to install conflicts. Is it possible to configure cabal to ignore the global package db?

I see the corresponding feature has been implemented in ghc itself, via a -no-global-package-db option (see https://ghc.haskell.org/trac/ghc/ticket/5977), and ghc-pkg will ignore the global package db if you do not pass it the --global flag. Is there a way to configure cabal similarly?

Also, there's a closed issue against cabal implying the opposite behavior (rebuilding everything instead of using packages from the installed Haskell Platform), so I'm not sure if this behavior has changed over time; see https://github.com/haskell/cabal/issues/1695

like image 693
Jeff Clites Avatar asked Dec 19 '25 11:12

Jeff Clites


1 Answers

You should be able to pass cabal configure the --package-db flag, documented like so:

--package-db=DB                  Append the given package database to the
                                 list of package databases used (to satisfy
                                 dependencies and register into). May be a
                                 specific file, 'global' or 'user'. The
                                 initial list is ['global'], ['global',
                                 'user'], or ['global', $sandbox],
                                 depending on context. Use 'clear' to reset
                                 the list to empty. See the user guide for
                                 details.

So in particular, you can pass it clear and then pass it just the sandbox db.

This is all discussed in wonderful detail in the Storage and Interpretation of Cabalized Packages article.

like image 172
sclv Avatar answered Dec 21 '25 04:12

sclv



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!