NixOS / cabal2nix

Generate Nix build instructions from a Cabal file
https://haskell4nix.readthedocs.io
Other
362 stars 156 forks source link

Fetch remote tarballs/zips using `nix-prefetch-url --unpack` #585

Open pwm opened 2 years ago

pwm commented 2 years ago

Fetching remote tarballs/zips is common enough of a use-case that warrants treating them specially by bypassing other fetching options and going for nix-prefetch-url --unpack directly. This speeds up large tarballs as cabal2nix currently downloads them twice, where the first fetch assumes an unpacked url and thus fails.

pwm commented 2 years ago

@dschrempf thanks for the feedback

I think the fetchPackedUrl function needs a top level comment explaining why it was added.

Agreed, will add.

Aslo, I think the process function should be top-leveled and reused (by fetch and fetchPackedUrl).

I actually did that first but then thought it might be better to try and minimise the change which is why i did it this way. Happy to lift it out (I think it makes sense) but that will mean a slightly bigger PR (not sure if that's an issue though).