
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. -- View this message in context: http://haskell.1045720.n5.nabble.com/change-location-of-user-s-package-direc... Sent from the Haskell - Glasgow-haskell-users mailing list archive at Nabble.com.

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.

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-direc... Sent from the Haskell - Glasgow-haskell-users mailing list archive at Nabble.com.

harry wrote
$ ghc-pkg check --package-db=~/cabal ghc-pkg: ~/cabal: openFile: does not exist (No such file or directory) $ ls ~/cabal package.cache
Ah, the ~ seems to have been tripping it up. Thank you. -- View this message in context: http://haskell.1045720.n5.nabble.com/change-location-of-user-s-package-direc... Sent from the Haskell - Glasgow-haskell-users mailing list archive at Nabble.com.

On Sun, Jul 28, 2013 at 5:35 AM, harry
$ ghc-pkg check --package-db=~/cabal ghc-pkg: ~/cabal: openFile: does not exist (No such file or directory) $ ls ~/cabal package.cache
Yet another reason to avoid ~... it's (a) only expanded by the shell, and (b) not reliably expanded even by the shell if it's not the very start of a word (as here where it is after =). Use $HOME instead. -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
participants (3)
-
Albert Y. C. Lai
-
Brandon Allbery
-
harry