Similar to what stack does, which would also allow us to abort early if the size is too big.
https://github.com/commercialhaskell/stackage-content/blob/13969bd12937e040a161aa0f0de118beab8e38d1/stack/stack-setup-2.yaml#L1529