locate: better mlocate support & cleanup

This commit is contained in:
Gregor Kleen 2017-01-26 12:56:53 +01:00
parent 142696de88
commit 114e738e41
2 changed files with 6 additions and 9 deletions

View File

@ -18,6 +18,7 @@ in {
locate = mkOption { locate = mkOption {
type = types.package; type = types.package;
default = pkgs.findutils; default = pkgs.findutils;
defaultText = "pkgs.findutils";
example = "pkgs.mlocate"; example = "pkgs.mlocate";
description = '' description = ''
The locate implementation to use The locate implementation to use
@ -38,9 +39,6 @@ in {
''; '';
}; };
# This is no longer supported, but we keep it to give a better warning below
period = mkOption { visible = false; };
extraFlags = mkOption { extraFlags = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = [ ]; default = [ ];
@ -58,7 +56,7 @@ in {
}; };
localuser = mkOption { localuser = mkOption {
type = types.str; type = types.nullOr types.str;
default = "nobody"; default = "nobody";
description = '' description = ''
The user to search non-network directories as, using The user to search non-network directories as, using
@ -76,10 +74,6 @@ in {
}; };
config = { config = {
warnings =
let opt = options.services.locate.period; in
optional opt.isDefined "The services.locate.period option in ${showFiles opt.files} has been removed; please replace it with services.locate.interval, using the systemd.time(7) calendar event format.";
systemd.services.update-locatedb = systemd.services.update-locatedb =
{ description = "Update Locate Database"; { description = "Update Locate Database";
path = [ pkgs.su ]; path = [ pkgs.su ];
@ -87,7 +81,7 @@ in {
'' ''
mkdir -m 0755 -p $(dirname ${toString cfg.output}) mkdir -m 0755 -p $(dirname ${toString cfg.output})
exec ${cfg.locate}/bin/updatedb \ exec ${cfg.locate}/bin/updatedb \
--localuser=${cfg.localuser} \ ${optionalString (cfg.localuser != null) ''--localuser=${cfg.localuser}''} \
${optionalString (!cfg.includeStore) "--prunepaths='/nix/store'"} \ ${optionalString (!cfg.includeStore) "--prunepaths='/nix/store'"} \
--output=${toString cfg.output} ${concatStringsSep " " cfg.extraFlags} --output=${toString cfg.output} ${concatStringsSep " " cfg.extraFlags}
''; '';

View File

@ -168,6 +168,9 @@ with lib;
# dhcpd # dhcpd
(mkRenamedOptionModule [ "services" "dhcpd" ] [ "services" "dhcpd4" ]) (mkRenamedOptionModule [ "services" "dhcpd" ] [ "services" "dhcpd4" ])
# locate
(mkRenamedOptionModule [ "services" "locate" "period" ] [ "services" "locate" "interval" ])
# Options that are obsolete and have no replacement. # Options that are obsolete and have no replacement.
(mkRemovedOptionModule [ "boot" "initrd" "luks" "enable" ] "") (mkRemovedOptionModule [ "boot" "initrd" "luks" "enable" ] "")
(mkRemovedOptionModule [ "programs" "bash" "enable" ] "") (mkRemovedOptionModule [ "programs" "bash" "enable" ] "")