AFAIK there's no way to selectively "hide" packages. However, you might be able to use cabal2nix4dev [1]. You'll have to modify the nix expressions to use your packages instead of the existing ones from the platform (in NIX they can happily coexist).

Perhaps somebody with direct NIX experience could provide more detailed step by step instructions?

Michal

[1] https://github.com/dave4420/cabal2nix4dev




On Wed, Oct 15, 2014 at 9:07 AM, Sven Panne <svenpanne@gmail.com> wrote:
As a maintainer of the various OpenGL-related packages I have the
following problem: The Haskell platform has those packages (OpenGLRaw,
GLURaw, ...) exposed, which is the right thing to do in general. When
I want to work on those packages, I'd like to use Cabal sandboxes to
avoid screwing up the platform versions of them, but things get a bit
tricky then. Consider e.g. the GLURaw package, which depends on the
OpenGLRaw package. Assume that I'd like to add some stuff to the
OpenGLRaw package and use that in GLURaw. With cabal sandboxes I'll
have to fight a little bit, because versions of these packages are
already exposed:

-----------------------------------------------------------------------------------------------------------------------
svenpanne@svenpanne[master]:~/repos/haskell-packages/GLURaw$ cabal sandbox init
Writing a default package environment file to
/usr/local/google/home/svenpanne/repos/haskell-packages/GLURaw/cabal.sandbox.config
Creating a new sandbox at
/usr/local/google/home/svenpanne/repos/haskell-packages/GLURaw/.cabal-sandbox
svenpanne@svenpanne[master]:~/repos/haskell-packages/GLURaw$ cabal
sandbox add-source ../OpenGLRaw
-----------------------------------------------------------------------------------------------------------------------

No problem so far. But the next step is not so OK:

-----------------------------------------------------------------------------------------------------------------------
svenpanne@svenpanne[master]:~/repos/haskell-packages/GLURaw$ cabal
install --only-dependencies
Resolving dependencies...
All the requested packages are already installed:
Use --reinstall if you want to reinstall anyway.
-----------------------------------------------------------------------------------------------------------------------

Hmmm, obviously cabal sees the globally exposed OpenGLRaw and ignores
that I've done add-source above. OK, next try with --constraint added:

-----------------------------------------------------------------------------------------------------------------------
svenpanne@svenpanne[master]:~/repos/haskell-packages/GLURaw$ cabal
install --only-dependencies --constraint='OpenGLRaw source'
Resolving dependencies...
In order, the following would be installed:
OpenGLRaw-1.5.0.0 (reinstall)
cabal: The following packages are likely to be broken by the reinstalls:
OpenGL-2.9.2.0
GLUT-2.5.1.1
GLURaw-1.4.0.1
Use --force-reinstalls if you want to install anyway.
-----------------------------------------------------------------------------------------------------------------------

(Is there any documentation about --constraint? I figured that out by
actually reading the cabal sources. :-/ ) Better, but still not OK, so
let's add --force-reinstalls:

-----------------------------------------------------------------------------------------------------------------------
svenpanne@svenpanne[master]:~/repos/haskell-packages/GLURaw$ cabal
install --only-dependencies --constraint='OpenGLRaw source'
--force-reinstalls
Resolving dependencies...
Warning: The following packages are likely to be broken by the reinstalls:
OpenGL-2.9.2.0
GLUT-2.5.1.1
GLURaw-1.4.0.1
Continuing even though the plan contains dangerous reinstalls.
Notice: installing into a sandbox located at
/usr/local/google/home/svenpanne/repos/haskell-packages/GLURaw/.cabal-sandbox
Configuring OpenGLRaw-1.5.0.0...
Building OpenGLRaw-1.5.0.0...
Installed OpenGLRaw-1.5.0.0
-----------------------------------------------------------------------------------------------------------------------

That works, so after that I could actually build/install GLURaw. So in
a nutshell what I have to do is:

   cabal sandbox init
   cabal sandbox add-source ../OpenGLRaw
   cabal install --constraint='OpenGLRaw source' --force-reinstalls
--enable-documentation --haddock-hyperlink-source

And for other packages I even have to add several --constraint flags,
because they depend on several locally modified packages. This seems a
bit weird. Is this the recommended workflow? How do other maintainers
of platform packages handle this? What one *actually* wants is hiding
some of the globally exposed packages while being in the sandbox
(--constraint and --force-reinstalls could go away then), but I've
found no way to do that.

Cheers,
   S.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe