NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.4k stars 14.35k forks source link

Move from zlib/minizip to zlib-ng/minizip-ng? #263750

Open vifino opened 1 year ago

vifino commented 1 year ago

The zlib-ng/minizip-ng libraries optionally have a compatible API and ABI, yet implement a bunch of performance optimizations along with using code sanitizers, fuzzing and code coverage. I suggest we should switch to them.

Fedora is considering the same and listed the benefits: ZlibNGTransition and MinizipNGTransition

minizip-ng

That transition is presumably smooth: Less consumers and all of them are not concerned by the extra dependencies as they are likely on the system regardless. Probably done quickly.

zlib-ng

This one probably requires more effort, as the zlib derivation has a bunch of logic regarding MinGW, Darwin and static/shared libraries. With some luck, a bunch of that is unnecessary by using CMake, but I haven't tried it yet.

theoparis commented 1 month ago

I tried to make an attempt at doing this from both an overlay and inside of a nixpkgs fork, and failed. The issue I encountered is that zlib-ng requires cmake, which requires libarchive/bzip2, which requires perl, which then requires zlib-ng. This resulted in an infinite recursion error 😕 Any ideas on how to solve this?

I simply changed pkgs/top-level/all-packages.nix to use zlib = zlib-ng.override { withZlibCompat = true; }; right below zlib-ng = callPackage