Skip to content

Commit 604c5e7

Browse files
committed
Update docs.
1 parent 68326c9 commit 604c5e7

File tree

1 file changed

+60
-17
lines changed

1 file changed

+60
-17
lines changed

README.md

+60-17
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,68 @@
11
# nix-search-cli
22

33
`nix-search` is a CLI client for [`search.nixos.org/packages`](https://search.nixos.org/packages).
4-
Use `nix-search` to find packages by name, description, installed programs, or other metadata.
5-
Does not work offline.
4+
Use `nix-search` to find packages by name, description, installed programs, version, or other metadata. Requires an active internet connection to work.
5+
6+
Major features and benefits:
7+
* Find how to install the binary you need
8+
* Searches work the same as the web interface by default
9+
* Use flags to explicitly query attribute names, installed programs, and versions
10+
* Each result is linked to the web interface (in supported terminals)
11+
* Results are compact and nicely colorized by default (in supported terminals)
12+
13+
```console
14+
$ nix-search --help
15+
search for packages via search.nixos.org
16+
17+
Usage:
18+
nix-search ...query [flags]
19+
20+
Examples:
21+
# Search
22+
# ... like the web interface
23+
nix-search python linter
24+
nix-search --search "python linter"
25+
# ... by attr name
26+
nix-search --attr python
27+
nix-search --attr 'emacsPackages.*'
28+
# ... by version
29+
nix-search --version 1.20
30+
nix-search --version '1.*'
31+
# ... by installed programs
32+
nix-search --program python
33+
nix-search --program "py*"
34+
# ... with ElasticSearch QueryString syntax
35+
nix-search --query-string="package_programs:(crystal OR irb)"
36+
nix-search --query-string='package_description:(MIT Scheme)'
37+
# ... with multiple filters and options
38+
nix-search --attr go --version 1.20 --details
39+
40+
Flags:
41+
-a, --attr string search by attr name
42+
-c, --channel string which channel to search in (default "unstable")
43+
-d, --details show expanded details for each result
44+
-h, --help help for nix-search
45+
-j, --json emit results in json-line format
46+
-m, --max-results int maximum number of results to return (default 20)
47+
-p, --program string search by installed programs
48+
-q, --query-string string perform an advanced query string format search
49+
-s, --search string default search, same as the website
50+
-v, --version string search by version
51+
```
652

7-
```bash
8-
# Search for a package
9-
nix-search <text to match>
53+
For example, here's how you would find all packages that install a `gcloud` binary. The results show the version ofe ach package as well as the full set of installed binaries. In a supported terminal, we use nice colors:
1054

11-
# Use a specific channel
12-
nix-search --channel unstable --query <text to match>
13-
# Show full usage / help
14-
nix-search --help
55+
```console
56+
$ ./bin/nix-search -p gcloud
57+
google-cloud-sdk-gce @ 408.0.1: gcloud bq docker-credential-gcloud git-credential-gcloud.sh gsutil
58+
google-cloud-sdk @ 408.0.1: gcloud bq docker-credential-gcloud git-credential-gcloud.sh gsutil
1559
```
1660

17-
For example, figuring out how to install `gcloud`:
18-
```shell
19-
# nix-search gcloud
20-
google-cloud-sdk-gce -> [bq, docker-credential-gcloud, gcloud, gsutil, git-credential-gcloud.sh]
21-
google-cloud-sdk -> [git-credential-gcloud.sh, docker-credential-gcloud, gcloud, bq, gsutil]
22-
rPackages.tagcloud
23-
perl536Packages.HTMLTagCloud
24-
perl534Packages.HTMLTagCloud
61+
Here's how you would find out how to install python 3.12:
62+
63+
```console
64+
$ ./bin/nix-search -p python -v 3.12
65+
python312 @ 3.12.0a5: python 2to3 2to3-3.12 idle idle3 idle3.12 pydoc pydoc3 pydoc3.12 python-config python3 python3-config python3.12 python3.12-config
2566
```
2667

2768
## Install
@@ -133,6 +174,8 @@ nix shell -c nix-search --help # directly run `nix-search` from inside this shel
133174
```
134175

135176
### Updating the gomod2nix file
177+
If you make changes that modify the golang dependencies, you'll need to update the pinned dependencies used in the Nix build process:
178+
136179
```bash
137180
gomod2nix
138181
```

0 commit comments

Comments
 (0)