4

I am facing a peculiar problem. Here at high school I have got about 10 computers (all are same type, same type cpu, same type memory etc) donated which are now running Debian after reinstall. I was try to teach the pupils some Haskell, I myself learned it little. The kids are interested. A problem is our country is third world and the internet is very slow and costly. The basic ghc and ghci I installed using deb packages (found by using apt-rdepends) on all machines after once downloading all of the deb files only on one machine using some limited time free internet connection. It has taken more than 10 hours to download the all ghc deb files that are missing.

I want know if such trick is possible for cabal? I will download all required tar or other files once, on one computer, using the costly and slow internet, but then I do not want spend all my money to download from internet for all 10 computers.

I want show the kids diagrams and gloss package as it is enjoyable and funny. I am inspired by this gentleman Smith How should I do this ? Is there way for other packages in general other than diagrams and gloss? Thank you and sorry for my bad English.

IBam
  • 10,114
  • 1
  • 24
  • 36
Kirkman
  • 51
  • 1
  • Have a look here: http://stackoverflow.com/questions/28522887/install-haskell-packages-using-cabal-without-internet-connection – IBam Aug 28 '15 at 13:24
  • thank you. I seen that, it just tells to download one package but no dependancies. is there a way to know the dependancies of diagrams using cabal? – Kirkman Aug 28 '15 at 13:39
  • 2
    I think what you're looking to do is copy `$HOME/.cabal/packages/hackage.haskell.org` to the other machines. – Michael Snoyman Aug 28 '15 at 13:58

2 Answers2

1

By default, cabal caches each package it downloads to ~/.cabal/packages (and prefers its cache to re-fetching the package unless you explicitly request a re-fetch). So it should be simple enough to just copy that directory between computers.

This would still require you to build all the packages on each machine. If you would prefer to skip even that step, you could consider directly copying GHC's package database around to each of the machines. This is a bit more delicate, but could save quite some time/power.

The global package database (where you should be installing packages that you want to be shared between users) is in /usr/local/lib/ghc-$version by default, and you should be able to copy that directory around to all your computers as well. You can check that you have installed the packages you want into the global database using ghc-pkg list, which will list all the package/version combos installed, separating them by whether they are installed in the global or user package database.

Daniel Wagner
  • 145,880
  • 9
  • 220
  • 380
0

In the past I have done this to get GHC and Cabal working on a machine behind a firewall that "cabal install" couldn't see through.

You can use "wget" to download the latest version of every Hackage package. (Or you might try doing something similar with Stack, but I haven't tried that). Also download https://hackage.haskell.org/packages/index.tar.gz, which is the index file.

Install GHC, cabal and cabal-install, and then find the cabal-install configuration file and point it at a local repository containing the index.tar.gz package and the archives for the packages that you downloaded. Then hopefully you should find "cabal install" will work from the local repository.

Paul Johnson
  • 17,438
  • 3
  • 42
  • 59