Cabal sandbox v. global package db

When installed inside an isolated isolated camera, cabal will still use packages from the global db package (in particular, packages supplied from the Haskell platform). This can lead to installation conflicts. Can cabal be configured to ignore the global db package?

I can see that the corresponding function was implemented in itself ghc

with an option -no-global-package-db

(see https://ghc.haskell.org/trac/ghc/ticket/5977 ) and ghc-pkg

will ignore the global db package unless you pass a flag to it --global

. Is there a way to configure cabal similarly?

There is also a closed issue against cabal implying the opposite behavior (restoring everything, not using packages from the installed Haskell platform), so I'm not sure if this change has changed over time; see https://github.com/haskell/cabal/issues/1695

+3


source to share


1 answer


You must pass a cabal configure

flag --package-db

, documented like this:

--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 only pass it as a sandboxed db.

This is discussed in detail in the article Storage and interpretation of packaged packages .

+1


source







All Articles