I have had to look directly in the /nix/store enough times that I lost count.
It would be pretty straightforward to show only what ends up in the path.
[nextos@local:~]$ python3
The program 'python3' is not in your PATH. It is provided by several packages.
You can make it available in an ephemeral shell by typing one of the following:
nix-shell -p graalvmCEPackages.graalvm11-ce-full
nix-shell -p graalvmCEPackages.graalvm17-ce-full
nix-shell -p graalvmCEPackages.python-installable-svm-java11
nix-shell -p graalvmCEPackages.python-installable-svm-java17
nix-shell -p ihaskell
nix-shell -p python311
nix-shell -p python311Full
nix-shell -p python312
nix-shell -p python38
nix-shell -p python38Full
nix-shell -p python39
nix-shell -p python39Full
nix-shell -p python3Full
nix-shell -p python3Minimal
nix-shell -p qtile
nix-shell -p sourcehut.python`nix-index` is a flake-compatible alternative: https://github.com/bennofs/nix-index
I love Nix, but really am not a fan of the Nix package listing website. So, it is nice to see.
And I guess worth mentioning, but if you or anyone else is ever feeling a little less lazy than me and want to add more available metadata, some of my main gripes with the official site:
- No easy way to see dependencies without viewing the package derivation source code.
- No easy way to see "reverse" dependencies, period, as far as I am aware, short of basically grepping the entire nixpkgs repo, and even then you won't get a totally accurate answer.
This seems like it'd be awful to implement given I don't think you can realistically know this information without evaluating the entirety of `all-packages.nix`. But it is something I miss about stuff like Arch Linux's package website. And I think in some ways, it is even more important with stuff like Nix if you intend to override a particular package globally, since you may end up needing to rebuild god knows how many things as a result.
- No easy way to filter by package types, outside of the very small set of existing package sets (e.g., `vimPackages`, `mpvScripts, etc).
As an example, I'd really like to be able to see all font packages in the nixpkgs repo, but there's just no nice way to do this easily, unlike some other package managers. It would be another kind of awful feature to implement, since there is not currently any grouping that I am aware of.
You /can/ kind of grep the `all-packages.nix` file and get a rough idea by searching for what packages call `./data/fonts`, but actually parsing that is pretty rough, since not everything is as simple as `font-name = callPackage ./data/fonts/font-name {};`
A good example of that parsing annoyance would be the noto-fonts [1].
- No easy way to see build options. For example, packages like `mpv` or `ffmpeg_5` have loads of different feature flags, some of which are unexpectedly disabled or enabled.
Again, I think this would be not fun to implement. But it is something that I think Gentoo gets really right with the listing of 'use flags' on their package listings [2] (in fact, Gentoo's site kind of gets everything right; it feels like the gold standard to me). NetBSD/pkgsrc is another one of the few that does well, albeit with a less-fancy design [3].
[1]: <https://github.com/NixOS/nixpkgs/blob/96c0fdeb6accc9f76f1887...>
[2]: <https://packages.gentoo.org/packages/media-video/ffmpeg>
[3]: <https://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/multimedia/...>
nix-store -qR `which python`
> No easy way to see "reverse" dependencies, period, as far as I am aware, short of basically grepping the entire nixpkgs repo, and even then you won't get a totally accurate answer.
nix-store -q --referrers `which python`
This and many other querying commands are explained in the Command Reference of Nix manual. Have you read it? [1]
[1] https://nixos.org/manual/nix/stable/command-ref/nix-store.ht...
$ nix-locate --top-level /bin/python3
remarkable2-toolchain.out 0 s /nix/store/lygxp772hm743v33wbri22f2k78k1vsb-remarkable2-toolchain-3.1.2/sysroots/cortexa7hf-neon-remarkable-linux-gnueabi/usr/bin/python3
remarkable2-toolchain.out 0 s /nix/store/lygxp772hm743v33wbri22f2k78k1vsb-remarkable2-toolchain-3.1.2/sysroots/cortexa7hf-neon-remarkable-linux-gnueabi/usr/bin/python3-config
remarkable2-toolchain.out 5,544 x /nix/store/lygxp772hm743v33wbri22f2k78k1vsb-remarkable2-toolchain-3.1.2/sysroots/cortexa7hf-neon-remarkable-linux-gnueabi/usr/bin/python3.8
remarkable2-toolchain.out 0 s /nix/store/lygxp772hm743v33wbri22f2k78k1vsb-remarkable2-toolchain-3.1.2/sysroots/cortexa7hf-neon-remarkable-linux-gnueabi/usr/bin/python3.8-config
remarkable2-toolchain.out 2,114 x /nix/store/lygxp772hm743v33wbri22f2k78k1vsb-remarkable2-toolchain-3.1.2/sysroots/cortexa7hf-neon-remarkable-linux-gnueabi/usr/bin/python3.8-config-lib
remarkable2-toolchain.out 0 s /nix/store/lygxp772hm743v33wbri22f2k78k1vsb-remarkable2-toolchain-3.1.2/sysroots/x86_64-codexsdk-linux/usr/bin/python3
remarkable2-toolchain.out 306 x /nix/store/lygxp772hm743v33wbri22f2k78k1vsb-remarkable2-toolchain-3.1.2/sysroots/x86_64-codexsdk-linux/usr/bin/python3.8
remarkable2-toolchain.out 18,432 x /nix/store/lygxp772hm743v33wbri22f2k78k1vsb-remarkable2-toolchain-3.1.2/sysroots/x86_64-codexsdk-linux/usr/bin/python3.8.real
remarkable-toolchain.out 0 s /nix/store/qk2p0ahd3nndi2zlwm9d0psahlrpikm0-remarkable-toolchain-3.1.2/sysroots/cortexa9hf-neon-remarkable-linux-gnueabi/usr/bin/python3
remarkable-toolchain.out 0 s /nix/store/qk2p0ahd3nndi2zlwm9d0psahlrpikm0-remarkable-toolchain-3.1.2/sysroots/cortexa9hf-neon-remarkable-linux-gnueabi/usr/bin/python3-config
remarkable-toolchain.out 5,544 x /nix/store/qk2p0ahd3nndi2zlwm9d0psahlrpikm0-remarkable-toolchain-3.1.2/sysroots/cortexa9hf-neon-remarkable-linux-gnueabi/usr/bin/python3.8
remarkable-toolchain.out 0 s /nix/store/qk2p0ahd3nndi2zlwm9d0psahlrpikm0-remarkable-toolchain-3.1.2/sysroots/cortexa9hf-neon-remarkable-linux-gnueabi/usr/bin/python3.8-config
remarkable-toolchain.out 2,114 x /nix/store/qk2p0ahd3nndi2zlwm9d0psahlrpikm0-remarkable-toolchain-3.1.2/sysroots/cortexa9hf-neon-remarkable-linux-gnueabi/usr/bin/python3.8-config-lib
remarkable-toolchain.out 0 s /nix/store/qk2p0ahd3nndi2zlwm9d0psahlrpikm0-remarkable-toolchain-3.1.2/sysroots/x86_64-codexsdk-linux/usr/bin/python3
remarkable-toolchain.out 306 x /nix/store/qk2p0ahd3nndi2zlwm9d0psahlrpikm0-remarkable-toolchain-3.1.2/sysroots/x86_64-codexsdk-linux/usr/bin/python3.8
remarkable-toolchain.out 18,432 x /nix/store/qk2p0ahd3nndi2zlwm9d0psahlrpikm0-remarkable-toolchain-3.1.2/sysroots/x86_64-codexsdk-linux/usr/bin/python3.8.real
qtile.out 15,872 x /nix/store/mrpll8c98mvnnzab5znqawz56dvq841j-qtile-0.22.1/bin/python3
qtile.out 15,872 x /nix/store/mrpll8c98mvnnzab5znqawz56dvq841j-qtile-0.22.1/bin/python3-config
qtile.out 15,872 x /nix/store/mrpll8c98mvnnzab5znqawz56dvq841j-qtile-0.22.1/bin/python3.10
qtile.out 15,872 x /nix/store/mrpll8c98mvnnzab5znqawz56dvq841j-qtile-0.22.1/bin/python3.10-config
python3Minimal.out 0 s /nix/store/igdcckxrd115041zvvcqmw9qxwf6pfxv-python3-minimal-3.10.8/bin/python3
python3Minimal.out 15,616 x /nix/store/igdcckxrd115041zvvcqmw9qxwf6pfxv-python3-minimal-3.10.8/bin/python3.10
python311.out 0 s /nix/store/ipaj21xdmnw2f2bs9mcd7czkzhdhbcfv-python3-3.11.1/bin/python3
python311.out 0 s /nix/store/ipaj21xdmnw2f2bs9mcd7czkzhdhbcfv-python3-3.11.1/bin/python3-config
python311.out 15,616 x /nix/store/ipaj21xdmnw2f2bs9mcd7czkzhdhbcfv-python3-3.11.1/bin/python3.11
python311.out 3,404 x /nix/store/ipaj21xdmnw2f2bs9mcd7czkzhdhbcfv-python3-3.11.1/bin/python3.11-config
python38.out 0 s /nix/store/n3ma7kwpssmwlgv118pc6k5ia0splp2m-python3-3.8.16/bin/python3
python38.out 0 s /nix/store/n3ma7kwpssmwlgv118pc6k5ia0splp2m-python3-3.8.16/bin/python3-config
python38.out 15,616 x /nix/store/n3ma7kwpssmwlgv118pc6k5ia0splp2m-python3-3.8.16/bin/python3.8
python38.out 3,444 x /nix/store/n3ma7kwpssmwlgv118pc6k5ia0splp2m-python3-3.8.16/bin/python3.8-config
python37.out 0 s /nix/store/a1gzdpyn8bbp192cavnxl6sa3snjx563-python3-3.7.16/bin/python3
python37.out 0 s /nix/store/a1gzdpyn8bbp192cavnxl6sa3snjx563-python3-3.7.16/bin/python3-config
python37.out 15,616 x /nix/store/a1gzdpyn8bbp192cavnxl6sa3snjx563-python3-3.7.16/bin/python3.7
python37.out 0 s /nix/store/a1gzdpyn8bbp192cavnxl6sa3snjx563-python3-3.7.16/bin/python3.7-config
python37.out 15,616 x /nix/store/a1gzdpyn8bbp192cavnxl6sa3snjx563-python3-3.7.16/bin/python3.7m
python37.out 3,210 x /nix/store/a1gzdpyn8bbp192cavnxl6sa3snjx563-python3-3.7.16/bin/python3.7m-config
python3Full.out 0 s /nix/store/rf7mdhqwpfzj239ylwim4rfqhw4fz52h-python3-3.10.8/bin/python3
python3Full.out 0 s /nix/store/rf7mdhqwpfzj239ylwim4rfqhw4fz52h-python3-3.10.8/bin/python3-config
python3Full.out 15,616 x /nix/store/rf7mdhqwpfzj239ylwim4rfqhw4fz52h-python3-3.10.8/bin/python3.10
python3Full.out 3,447 x /nix/store/rf7mdhqwpfzj239ylwim4rfqhw4fz52h-python3-3.10.8/bin/python3.10-config
python38Full.out 0 s /nix/store/b5yxnf8vq4rdkbz1z8wydhcxz3r1zsg7-python3-3.8.16/bin/python3
python38Full.out 0 s /nix/store/b5yxnf8vq4rdkbz1z8wydhcxz3r1zsg7-python3-3.8.16/bin/python3-config
python38Full.out 15,616 x /nix/store/b5yxnf8vq4rdkbz1z8wydhcxz3r1zsg7-python3-3.8.16/bin/python3.8
python38Full.out 3,444 x /nix/store/b5yxnf8vq4rdkbz1z8wydhcxz3r1zsg7-python3-3.8.16/bin/python3.8-config
sourcehut.python.out 0 s /nix/store/lbn7f0d2k36i4bgfdrjdwj7npy3r3h5d-python3-3.10.8/bin/python3
sourcehut.python.out 0 s /nix/store/lbn7f0d2k36i4bgfdrjdwj7npy3r3h5d-python3-3.10.8/bin/python3-config
sourcehut.python.out 15,616 x /nix/store/lbn7f0d2k36i4bgfdrjdwj7npy3r3h5d-python3-3.10.8/bin/python3.10
sourcehut.python.out 3,447 x /nix/store/lbn7f0d2k36i4bgfdrjdwj7npy3r3h5d-python3-3.10.8/bin/python3.10-config
python39Full.out 0 s /nix/store/ckxlmknrfn6c55jwnw86ha9440w4a9ff-python3-3.9.15/bin/python3
python39Full.out 0 s /nix/store/ckxlmknrfn6c55jwnw86ha9440w4a9ff-python3-3.9.15/bin/python3-config
python39Full.out 15,616 x /nix/store/ckxlmknrfn6c55jwnw86ha9440w4a9ff-python3-3.9.15/bin/python3.9
python39Full.out 3,444 x /nix/store/ckxlmknrfn6c55jwnw86ha9440w4a9ff-python3-3.9.15/bin/python3.9-config
python39.out 0 s /nix/store/hm6bqikghylrwgvqd42lgghjdq9p3hac-python3-3.9.15/bin/python3
python39.out 0 s /nix/store/hm6bqikghylrwgvqd42lgghjdq9p3hac-python3-3.9.15/bin/python3-config
python39.out 15,616 x /nix/store/hm6bqikghylrwgvqd42lgghjdq9p3hac-python3-3.9.15/bin/python3.9
python39.out 3,444 x /nix/store/hm6bqikghylrwgvqd42lgghjdq9p3hac-python3-3.9.15/bin/python3.9-config
python37Full.out 0 s /nix/store/ys4my3x7wwb6r6mwfkyk6q9pay2jm3dz-python3-3.7.16/bin/python3
python37Full.out 0 s /nix/store/ys4my3x7wwb6r6mwfkyk6q9pay2jm3dz-python3-3.7.16/bin/python3-config
python37Full.out 15,616 x /nix/store/ys4my3x7wwb6r6mwfkyk6q9pay2jm3dz-python3-3.7.16/bin/python3.7
python37Full.out 0 s /nix/store/ys4my3x7wwb6r6mwfkyk6q9pay2jm3dz-python3-3.7.16/bin/python3.7-config
python37Full.out 15,616 x /nix/store/ys4my3x7wwb6r6mwfkyk6q9pay2jm3dz-python3-3.7.16/bin/python3.7m
python37Full.out 3,210 x /nix/store/ys4my3x7wwb6r6mwfkyk6q9pay2jm3dz-python3-3.7.16/bin/python3.7m-config
ihaskell.out 294 x /nix/store/yj8p9gd2irrh0z16d3b0ljv4vps920h7-ihaskell-with-packages/bin/python3
ihaskell.out 301 x /nix/store/yj8p9gd2irrh0z16d3b0ljv4vps920h7-ihaskell-with-packages/bin/python3-config
ihaskell.out 297 x /nix/store/yj8p9gd2irrh0z16d3b0ljv4vps920h7-ihaskell-with-packages/bin/python3.10
ihaskell.out 304 x /nix/store/yj8p9gd2irrh0z16d3b0ljv4vps920h7-ihaskell-with-packages/bin/python3.10-config
google-cloud-sdk.out 20,744 x /nix/store/7dw9fdkqs25fiwzq3r2z1y21gc97c8wd-google-cloud-sdk-408.0.1/google-cloud-sdk/platform/bundledpythonunix/bin/python3
google-cloud-sdk.out 3,254 x /nix/store/7dw9fdkqs25fiwzq3r2z1y21gc97c8wd-google-cloud-sdk-408.0.1/google-cloud-sdk/platform/bundledpythonunix/bin/python3-config
google-cloud-sdk.out 20,744 x /nix/store/7dw9fdkqs25fiwzq3r2z1y21gc97c8wd-google-cloud-sdk-408.0.1/google-cloud-sdk/platform/bundledpythonunix/bin/python3.9
google-cloud-sdk.out 3,254 x /nix/store/7dw9fdkqs25fiwzq3r2z1y21gc97c8wd-google-cloud-sdk-408.0.1/google-cloud-sdk/platform/bundledpythonunix/bin/python3.9-config
google-cloud-sdk-gce.out 20,744 x /nix/store/b96rpkxpw920sbbswz1xrrrpjdb1f30c-google-cloud-sdk-408.0.1/google-cloud-sdk/platform/bundledpythonunix/bin/python3
google-cloud-sdk-gce.out 3,254 x /nix/store/b96rpkxpw920sbbswz1xrrrpjdb1f30c-google-cloud-sdk-408.0.1/google-cloud-sdk/platform/bundledpythonunix/bin/python3-config
google-cloud-sdk-gce.out 20,744 x /nix/store/b96rpkxpw920sbbswz1xrrrpjdb1f30c-google-cloud-sdk-408.0.1/google-cloud-sdk/platform/bundledpythonunix/bin/python3.9
google-cloud-sdk-gce.out 3,254 x nix-locate --top-level --regex '^/bin/python3'
Which will only show packages with "/bin/python3" in the root.Most of the time this is unnecessary, but since python gets vendored in a lot of packages, it comes up with this example.
$ nix-locate --top-level -1 --regex '^/bin/python3'
qtile.out
python3Minimal.out
python311.out
python38.out
python37.out
python3Full.out
python38Full.out
sourcehut.python.out
python39Full.out
python39.out
python37Full.out
ihaskell.out
Also things like "python3" and "gcc" and such are going to show way more hits than, for example, "firefox": $ nix-locate --top-level -1 --regex '^/bin/firefox'
firefox-esr-102-unwrapped.out
firefox_decrypt.out
firefox-unwrapped.out
firefox.out #!/bin/sh
results="$(nix-locate -1 --regex --top-level "^/bin/${1}\$")"
for item in $results; do
nix search "nixpkgs#${item%.*}"
done
Example: $ ./nix-find-executable.sh python3
* legacyPackages.x86_64-linux.qtile (0.22.1)
A small, flexible, scriptable tiling window manager written in Python
* legacyPackages.x86_64-linux.python3Minimal (3.10.8)
A high-level dynamically-typed programming language
* legacyPackages.x86_64-linux.python311 (3.11.1)
A high-level dynamically-typed programming language
* legacyPackages.x86_64-linux.python38 (3.8.16)
A high-level dynamically-typed programming language
* legacyPackages.x86_64-linux.python37 (3.7.16)
A high-level dynamically-typed programming language
* legacyPackages.x86_64-linux.python3Full (3.10.8)
A high-level dynamically-typed programming language
* legacyPackages.x86_64-linux.python38Full (3.8.16)
A high-level dynamically-typed programming language
* legacyPackages.x86_64-linux.sourcehut.python (3.10.8)
A high-level dynamically-typed programming language
* legacyPackages.x86_64-linux.python39Full (3.9.15)
A high-level dynamically-typed programming language
* legacyPackages.x86_64-linux.python39 (3.9.15)
A high-level dynamically-typed programming language
* legacyPackages.x86_64-linux.python37Full (3.7.16)
A high-level dynamically-typed programming language
* legacyPackages.x86_64-linux.ihaskell