Findutils missing locate and updatedb

I am having a problem accessing the “locate” program:

[buck@nixos:~]$ locate
The program ‘locate’ 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 findutils
nix-shell -p mlocate

[buck@nixos:~]$ nix-shell -p findutils

[nix-shell:~]$ locate
The program ‘locate’ 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 findutils
nix-shell -p mlocate

find and xargs are available. locate and updatedb are missing. The man page has this cryptic segmentation:

The tools supplied with this package are:

* find - search for files in a directory hierarchy;
* xargs - build and execute command lines from standard input.

The following are available in the locate output:

* locate - list files in databases that match a pattern;
* updatedb - update a file name database;

What does “the locate output” refer to? I added “findutils” to configuration.nix and I still have no access to “locate”.

What does “the locate output” refer to? I added “findutils” to configuration.nix and I still have no access to “locate”.

  nix-shell -p findutils.locate

But you probably want to use this instead:

{
  services.locate.enable = true;
}

1 Like

why can’t I enable this service from my home-manager , if I can install the package there and I have enabled gpg service from there only?

Because locate needs more than just having the locate binary available.

Take a look at the nixos module to see what happens: nixpkgs/nixos/modules/misc/locate.nix at c9824ffab202aa125cceacfe627f599e15439e12 · NixOS/nixpkgs · GitHub