Next: , Previous: , Up: Services   [Contents][Index]

11.9.11 File Search Services

The services in this section populate file databases that let you search for files on your machine. These services are provided by the (gnu services admin) module.

The first one, file-database-service-type, periodically runs the venerable updatedb command (see Invoking updatedb in GNU Findutils). That command populates a database of file names that you can then search with the locate command (see Invoing locate in GNU Findutils), as in this example:

locate important-notes.txt

You can enable this service with its default settings by adding this snippet to your operating system services:

(service file-database-service-type)

This updates the database once a week, excluding files from /gnu/store—these are more usefully handled by guix locate (see Invoking guix locate). You can of course provide a custom configuration, as described below.

Variable: file-database-service-type

This is the type of the file database service, which runs updatedb periodically. Its associated value must be a file-database-configuration record, as described below.

Data Type: file-database-configuration

Record type for the file-database-service-type configuration, with the following fields:

package (default: findutils)

The GNU Findutils package from which the updatedb command is taken.

schedule (default: %default-file-database-update-schedule)

String or G-exp denoting an mcron schedule for the periodic updatedb job (see Guile Syntax in GNU mcron).

excluded-directories (default %default-file-database-excluded-directories)

List of regular expressions of directories to ignore when building the file database. By default, this includes /tmp and /gnu/store; the latter should instead be indexed by guix locate (see Invoking guix locate). This list is passed to the --prunepaths option of updatedb (see Invoking updatedb in GNU Findutils).

The second service, package-database-service-type, builds the database used by guix locate, which lets you search for packages that contain a given file (see Invoking guix locate). The service periodically updates a system-wide database, which will be readily available to anyone running guix locate on the system. To use this service with its default settings, add this snippet to your service list:

(service package-database-service-type)

This will run guix locate --update once a week.

Variable: package-database-service-type

This is the service type for periodic guix locate updates (see Invoking guix locate). Its value must be a package-database-configuration record, as shown below.

Data Type: package-database-configuration

Data type to configure periodic package database updates. It has the following fields:

package (default: guix)

The Guix package to use.

schedule (default: %default-package-database-update-schedule)

String or G-exp denoting an mcron schedule for the periodic guix locate --update job (see Guile Syntax in GNU mcron).

method (default: 'store)

Indexing method for guix locate. The default value, 'store, yields a more complete database but is relatively expensive in terms of CPU and input/output.

channels (default: #~%default-channels)

G-exp denoting the channels to use when updating the database (see Channels).

Next: Database Services, Previous: Sound Services, Up: Services   [Contents][Index]