Ports over 828ffb210af7a8d82081217d41b06cbf151a6ed9 and
774a7e1e78e4911ad5d2c9917b568e172d43a6f6 from the nix tree.
It's a bit verbose, but no way around that with modular packaging. This
does mean that -c libraries now get both libraries - static archives
and shared libraries, but -c bindings are pretty small (~100KiB) each so
this is not expected to be an issue.
Co-authored-by: Riccardo Mazzarini <me@noib3.dev>
This is a port of
cb5b0c30aa
from https://github.com/NixOS/nix/pull/14489 but adopted to preserve
dependency order, and this not cause rebuilds.
We only need the one commit of that PR because we don't care about a dev
shell for Nix in Nixpkgs.