Flox Package Database 1
CRUD Operations on Nix Package Metadata
|
The pkgdb search
command may be used to search for packages which match a set of query
filters in a set of registry inputs.
This command accepts JSON input and emits JSON output, which are described below.
pkgdb
search accepts either a path to a JSON file or inline JSON with the following abstract schema:
SearchQuery
match-name
: Partially match a package's name
or pname
fields as well as on a calculated column attrName
.match
.attrName
is the last attribute path element for packages
and legacyPackages
subtrees.match
: Partially match a package's name
, pname
, or description
fields as well as on a calculated column attrName
.query.match-name
.attrName
is the last attribute path element for packages
and legacyPackages
subtrees.semver
: a node-semver range filter.npm
, yarn
, pip
, and many other package managers.name
: Exactly match the derivation's name
attribute.pname
: Exactly match the derivation's pname
attribute.pname
field it will be parsed from the derivation's name
attribute using builtins.parseDrvName
.version
: Exactly match a derivation's version
field.version
field it will be parsed from the derivation's name
attribute using builtins.parseDrvName
.manifest
: An optional path to a Manifest, or an inline JSON manifest.global-manifest
: A path to a GlobalManifest or an inline JSON GlobalManifest.manifest
and lockfile
are.lockfile
: An optional path to an existing Lockfile, or an inline JSON Lockfile.See the corresponding documentation for global manifests, manifests, and lockfiles for details on those schemas.
Below is an example query that searches four flakes for any package matching the string "hello" with major version 2 , usable on x86_64-linux
.
In the example above we'll make a few observations to clarify how defaults are applied to inputs
by showing the explicit form of the same params:
inputs.<NAME>.subtrees
was applied to all inputs which didn't explicitly specify them.inputs.<NAME>.from
flake references were parsed and locked.allow
and semver
fields were added with their default values.priority
list added missing inputs in lexicographical order.query.*
fields were filled with null
.Search results are printed as JSON objects with one result per line ordered such that high ranking results appear before low ranking results.
This single result per line format is printed in chunks as each input is processed, and is suitable for streaming across a pipe. Tools such as jq
or sed
may be used in combination with pkgdb search
so that results are displayed to users as they are processed.
Each output line has the following format:
Note that because the input
field only prints the short-name of its input, it is strongly recommended that the caller use locked flake references.
For the example query parameters given above, we get the following results: