Skip to content

Instantly share code, notes, and snippets.

@AndreasPK
Created February 9, 2020 15:06
Show Gist options
  • Save AndreasPK/795c62801c05c07ff0982c0711c4b700 to your computer and use it in GitHub Desktop.
Save AndreasPK/795c62801c05c07ff0982c0711c4b700 to your computer and use it in GitHub Desktop.
# First get a list of all packages
cabal list --simple | tee packages.list
# Then compute the locations of their tar files
python3 -c "from fileinput import *; [print(\"https://hackage.haskell.org/package/\"+p+\"/\"+p+\"-\"+ver+\".tar.gz\") for (p,ver) in sorted(dict(map(str.split, input())).items())]" < packages.list | tee files.list
# If you are on windows make sure python didn't use CRLF:
# dos2unix files.list
# Download all the archives - 4 at a time. Some might fail, that is expected.
xargs -P4 wget -nv < files.list
# Do whatever you want afterwards. This was based on https://github.com/nh2/hackage-download, which sadly did not work for me.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment