Source: https://nixos.wiki/wiki/Packaging/Binaries#Extra_Dynamic_Libraries
# First, you need to index your channel packages
$ nix-index
# Then you can locate the file:
$ nix-locate -1 -w lib/libsane.so.1
(xsane.out)
(wineWowPackages.staging.out)
saneBackendsGit.out
sane-backends.out
(lutris-free.out)
# libsdtc++.so.6 is `special`, it resides in stdenv.cc.cc.lib (see other packages)
$ nix-locate -1 -w lib/libstdc++.so.6
You need to select the packages by hand because there may be multiple choices.
There is a handy tool for automate this process: https://github.com/lexleogryfon/de-generate