-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Which package provides file "foo" #1751
Comments
I see that "GitHub search" is actually a lot more useless than I thought it was; it doesn't seem to do full-text search. Second issue; when I said "fine, no problem", I was wrong. I don't know what that error message is asking me to do. I can see that the git package is a function that accepts an argument
where |
In the case of "gitk" it isn't listed no matter how you search, because it is not a separate package but included in the "git" package. Nix has a "command-not-found" functionality similar to Ubuntu. If you try to run a command and it isn't installed on your system, nix will suggest a package that provides that binary. This functionality is provided by Hydra which builds a sqlite database of files from packages' /bin and /sbin directories. When you update your channel sources you also get a copy of this database. A more general "file index" built by Hydra would be really nice to have, similar to "apt-file" on Debian/Ubuntu. That way we could locate which package any file is located in, not just binaries. For example, figuring out what package to install to provide "some-header.h" would be nice. |
Ah, I wasn't aware of this command-not-found functionality. It seems Nix has that as well as a convention that packages like git create dummy programs for things like Notes to self on how this works: there's a literal program
I notice it only gets used in bash, not /bin/sh, so I assume there's some bash hook for when a program is not found on the PATH. |
And yes, it would be very useful if Which uses a file at: /nix/var/nix/profiles/per-user/root/channels/nixos/programs.sqlite |
I wouldn't call it a convention. I don't think any package other than |
IMO this is a bug in |
+1 for removal. |
note: it's rather frustrating to find this 6+ years old discussion as a nixos newbie, yet still spending long-long minutes failing to find out how to enable guiSupport for git... |
@attila-lendvai just solved it, use |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: |
I wanted to find out how to install
gitk
. I ran:I then searched for it in the nixpkgs repository and found nothing.
I then realized that, actually, I already have it on my path:
Fine, no problem. (Though I don't know where that error message comes from; I would have thought it would be in
nixpkgs
somewhere and so would have appeared in my github search.)But I wouldn't have been able to figure this out had I not already had the
git
package installed.Is there any general way to search for packages providing some file or program? E.g. do package definitions declare what programs they produce on compilation? Or can I search on Hydra for packages that produced such-and-such file?
Such a facility is provided by at least Ubuntu/Debian/yum, I believe.
The text was updated successfully, but these errors were encountered: