change location of user's package directory

harry voldermort at hotmail.com
Sun Jul 28 11:35:25 CEST 2013


Albert Y. C. Lai wrote
> On 13-07-25 03:14 PM, harry wrote:
>> How can I change the location that ghc and ghc-pkg use for the user's
>> package
>> directory? I'm running GHC in a very restricted environment where I don't
>> have access to $HOME, but I can use specific subdirectories.
> 
> Cannot. But you have another option. GHC and cabal-install support 
> further package databases than global and user.
> 
> To initialize:
> 
>      mkdir /joy (or other ways to make /joy exist and be empty)
>      ghc-pkg --package-db=/joy recache
> 
> Note: two hyphens, -- not -
> 
> 
> To cabal-install:
> 
>      cabal --package-db=/joy --prefix=/delight install acme-dont
> 
> Note: you must provide a custom --prefix. The default is $HOME/.cabal 
> which is exactly what you can't use.
> 
> 
> To ghc-pkg:
> 
>      ghc-pkg --global --package-db=/joy list
>      ghc-pkg --package-db=/joy unregister acme-dont
> 
> However, beware of http://ghc.haskell.org/trac/ghc/ticket/5442
> 
> 
> To ghc or ghci:
> 
>      ghc -package-db=/joy
> 
> Note: one hyphen: - not --
> (Don't you love to memorize random conventions.)
> (In older versions of GHC, it was even better:
>      cabal --package-db=/joy
>      ghc-pkg --package-conf=/joy
>      ghc -package-conf=/joy
> Don't you love to memorize random conventions.)
> 
> Read the full story in GHC User's Guide section 4.9 "Packages". It comes 
> with GHC on your hard disk.

$ ghc-pkg check --package-db=~/cabal
ghc-pkg: ~/cabal: openFile: does not exist (No such file or directory)
$ ls ~/cabal
package.cache




--
View this message in context: http://haskell.1045720.n5.nabble.com/change-location-of-user-s-package-directory-tp5733451p5733512.html
Sent from the Haskell - Glasgow-haskell-users mailing list archive at Nabble.com.




More information about the Glasgow-haskell-users mailing list