NixOS / cabal2nix

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

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

Open pwm opened 1 year ago

pwm commented 1 year 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 1 year 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).