Skip to content

Instantly share code, notes, and snippets.

@monadplus
Created March 4, 2020 08:58
Show Gist options
  • Save monadplus/d3e89208a28cdedc33b638358161b90e to your computer and use it in GitHub Desktop.
Save monadplus/d3e89208a28cdedc33b638358161b90e to your computer and use it in GitHub Desktop.
Nix: locate a file in any package (for example, .so)

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment