Merge pull request #8036 from Profpatsch/locate

locate: option includeStore
This commit is contained in:
lethalman 2015-08-03 10:23:30 +02:00
commit fa7860f84d
2 changed files with 18 additions and 1 deletions

View file

@ -179,6 +179,15 @@ nix-env -f "<nixpkgs>" -iA haskellPackages.cabal-install
</para> </para>
</listitem> </listitem>
<listitem>
<para>
The <literal>locate</literal> service no longer indexes the nix store
by default, preventing packages with potentially numerous versions from
cluttering the output. Indexing the store can be activated with
<literal>services.locate.includeStore = true;</literal>.
</para>
</listitem>
</itemizedlist> </itemizedlist>
</para> </para>

View file

@ -56,6 +56,14 @@ in {
''; '';
}; };
includeStore = mkOption {
type = types.bool;
default = false;
description = ''
Whether to include /nix/store in the locate database.
'';
};
}; };
}; };
@ -63,7 +71,6 @@ in {
###### implementation ###### implementation
config = { config = {
systemd.services.update-locatedb = systemd.services.update-locatedb =
{ description = "Update Locate Database"; { description = "Update Locate Database";
path = [ pkgs.su ]; path = [ pkgs.su ];
@ -72,6 +79,7 @@ in {
mkdir -m 0755 -p $(dirname ${toString cfg.output}) mkdir -m 0755 -p $(dirname ${toString cfg.output})
exec updatedb \ exec updatedb \
--localuser=${cfg.localuser} \ --localuser=${cfg.localuser} \
${optionalString (!cfg.includeStore) "--prunepaths='/nix/store'"} \
--output=${toString cfg.output} ${concatStringsSep " " cfg.extraFlags} --output=${toString cfg.output} ${concatStringsSep " " cfg.extraFlags}
''; '';
serviceConfig.Nice = 19; serviceConfig.Nice = 19;