nix-index is what you need.
Install and build the index:
nix-env -iA nixos.nix-index
nix-index
Locate libgtk-x11-2.0.so.0:
nix-locate -w libgtk-x11-2.0.so.0
Output:
(zed.out) 0 s /nix/store/bc4mngklj2j7hmm21jra4641x4pm9r8z-node-webkit-env/lib/libgtk-x11-2.0.so.0
(thrust.out) 0 s /nix/store/wzg0k4i2cy0qsm3hwxlywxxbga019hbq-env-thrust/lib/libgtk-x11-2.0.so.0
(nwjs_0_12.out) 0 s /nix/store/js6klvzjfi5q4djmwb0bqzfb4x0vzm6g-nwjs-env/lib/libgtk-x11-2.0.so.0
(node_webkit_0_11.out) 0 s /nix/store/30vm6a7bmc56ckl575rqassw60ccxjpg-node-webkit-env/lib/libgtk-x11-2.0.so.0
(mumble_overlay.out) 0 s /nix/store/wayx023w1nslqg2z0c5v4n0b4jxn5n06-gtk+-2.24.31/lib/libgtk-x11-2.0.so.0
gnome2.gtk.out 0 s /nix/store/3iqchhncghm5s458lzy99c3prfymrnp2-gtk+-2.24.31/lib/libgtk-x11-2.0.so.0
The last line says that package gtk+-2.24.31 with attribute path gnome2.gtk contains this file.
yumanddnfin RPMland) allow you to say "install file", they figure out the right package and install that one. – vonbrand Dec 29 '15 at 21:12$ command-not-found foo). Note that searching nix files (e.g. with ctags) won't help there. You do have to perform the build to find what it installs. – Vladimír Čunát Dec 30 '15 at 09:37INSTALLfile of the package (for which you want to create the environment), namely theRequirements/Dependenciessection for the packages you have to have pre-installed. Then look for the packages innixpkgs. (In other words, package managers are about packages not files...) – Andrew Mar 19 '16 at 00:48yum provides '*/bin/grep'ordnf provides '*/bin/greporapt-file search 'fprintf.3.gz'. – maxschlepzig Oct 31 '16 at 22:18