Is it possible for cabal sandboxes to use $HOME/.cabal/lib?

Hi all, There are some packages that I use again and again and I would like to install them once (but not in a system-wide location) and then have cabal sandboxes use that install, instead of installing them in every sandbox, which is time consuming. Is there a way do that? For example, I noticed that cabal, when operating inside a sandbox, can still find the packages installed system-wide, but not the ones in $HOME/.cabal/lib. Can I change that? Thanks

Hi Aldo,
Maybe what you want to do is "cabal sandbox init
--sandbox=$HOME/.cabal/lib/".
Specify "--sandbox=" option.
2015-03-30 13:05 GMT+09:00 Aldo Davide
Hi all,
There are some packages that I use again and again and I would like to install them once (but not in a system-wide location) and then have cabal sandboxes use that install, instead of installing them in every sandbox, which is time consuming. Is there a way do that? For example, I noticed that cabal, when operating inside a sandbox, can still find the packages installed system-wide, but not the ones in $HOME/.cabal/lib. Can I change that?
Thanks _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
-- 山本悠滋 twitter: @igrep Facebook: http://www.facebook.com/igrep Google+: https://plus.google.com/u/0/+YujiYamamoto_igrep

Hi all,
Not sure, but is this possible to copy your home cabal sandbox to
./.cabal-sandbox? Then you'll have all your default packages available and
won't build them again.
On Mon, Mar 30, 2015 at 8:02 AM, Aldo Davide
Hi Yuji,
The --sandbox option is used to specify the sandbox location. I want my sandbox to be in ./.cabal-sandbox, i.e. the default location.
To clarify, I want to be able to create multiple independent sandboxes, that take advantage of the packages installed in $HOME/.cabal, just like how they take advantage of the system-wide install packages.
*Sent:* Monday, March 30, 2015 at 5:48 AM *From:* "Yuji Yamamoto"
*To:* "Aldo Davide" *Cc:* "Haskell Cafe" *Subject:* Re: [Haskell-cafe] Is it possible for cabal sandboxes to use $HOME/.cabal/lib? Hi Aldo, Maybe what you want to do is "cabal sandbox init --sandbox=$HOME/.cabal/lib/". Specify "--sandbox=" option.
2015-03-30 13:05 GMT+09:00 Aldo Davide
: Hi all,
There are some packages that I use again and again and I would like to install them once (but not in a system-wide location) and then have cabal sandboxes use that install, instead of installing them in every sandbox, which is time consuming. Is there a way do that? For example, I noticed that cabal, when operating inside a sandbox, can still find the packages installed system-wide, but not the ones in $HOME/.cabal/lib. Can I change that?
Thanks _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
-- 山本悠滋 twitter: @igrep Facebook: http://www.facebook.com/igrep Google+: https://plus.google.com/u/0/+YujiYamamoto_igrep
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

On Mon, Mar 30, 2015 at 2:42 PM, Alexey Shmalko
Not sure, but is this possible to copy your home cabal sandbox to ./.cabal-sandbox? Then you'll have all your default packages available and won't build them again.
You'd need to fix paths in the package database and `cabal hc-pkg recache` (if that works; might need cabal exec). -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

Ok. Seems that I get this method working.
Just copied .cabal-sandbox and caba.sandbox.config over new location.
Replaced all occurrences of the old path to the new one in
cabal.sandbox.config and
.cabal-sandbox/x86_64-linux-ghc-7.8.4-packages.conf.d/*.conf. After that I
executed `cabal sandbox hc-pkg recache` and everything seems to work.
Doesn't seem like a sane solution, but can be used if absolutely needed.
On Mon, Mar 30, 2015 at 10:11 PM, Brandon Allbery
On Mon, Mar 30, 2015 at 2:42 PM, Alexey Shmalko
wrote: Not sure, but is this possible to copy your home cabal sandbox to ./.cabal-sandbox? Then you'll have all your default packages available and won't build them again.
You'd need to fix paths in the package database and `cabal hc-pkg recache` (if that works; might need cabal exec).
-- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

So basically, I think it would be useful for cabal to be able to support an arbitrary list of directories, e.g.:
/home/user/projects/foo/.cabal-sandbox/x86_64-linux-ghc-7.8.4-packages.conf.d
/home/user/.ghc/x86_64-linux-7.8.4/package.conf.d
/usr/lib64/ghc-7.8.4/package.conf.d
Whenever a package is needed, then it would look it up in all of those directories. If a new package is to be installed, it would be installed in the topmost directory. In other words, it would overlay these directories one on top of the other, with the topmost one being used for read-write and the other ones being read-only.
I understand that many people think that an implementation of nix-style packages would solve those issues, but I think the approach I describe above has its own merits.
Sent: Monday, March 30, 2015 at 9:04 PM
From: "Alexey Shmalko"

On 2015-03-30 04:57 PM, Aldo Davide wrote:
So basically, I think it would be useful for cabal to be able to support an arbitrary list of directories, e.g.:
/home/user/projects/foo/.cabal-sandbox/x86_64-linux-ghc-7.8.4-packages.conf.d /home/user/.ghc/x86_64-linux-7.8.4/package.conf.d /usr/lib64/ghc-7.8.4/package.conf.d
Whenever a package is needed, then it would look it up in all of those directories. If a new package is to be installed, it would be installed in the topmost directory. In other words, it would overlay these directories one on top of the other, with the topmost one being used for read-write and the other ones being read-only.
This has always been available. See my http://www.vex.net/~trebla/haskell/sicp.xhtml#sandbox In fact, read the whole thing.

On April 04, 2015 at 6:40 PM, Albert Y. C. Lai wrote:
On 2015-03-30 04:57 PM, Aldo Davide wrote:
So basically, I think it would be useful for cabal to be able to support an arbitrary list of directories, e.g.:
/home/user/projects/foo/.cabal-sandbox/x86_64-linux-ghc-7.8.4-packages.conf.d /home/user/.ghc/x86_64-linux-7.8.4/package.conf.d /usr/lib64/ghc-7.8.4/package.conf.d
Whenever a package is needed, then it would look it up in all of those directories. If a new package is to be installed, it would be installed in the topmost directory. In other words, it would overlay these directories one on top of the other, with the topmost one being used for read-write and the other ones being read-only.
This has always been available. See my
http://www.vex.net/~trebla/haskell/sicp.xhtml#sandbox
In fact, read the whole thing.
Thanks for the link to the article, interesting stuff. It's good to see that ghc as well as the install sub-command of cabal accept an arbitrary stack of package dbs. Unfortunately, I still haven't found a way to make sandboxes use these capabilities. I tried to create a cabal.config file inside a sandbox (like the comment at the top of cabal.sandbox.config suggests), but it does not make any difference if I include a package-db line in there.
participants (5)
-
Albert Y. C. Lai
-
Aldo Davide
-
Alexey Shmalko
-
Brandon Allbery
-
Yuji Yamamoto