@@ -43,6 +43,9 @@ in {
4343 The format is described in
4444 <citerefentry><refentrytitle>systemd.time</refentrytitle>
4545 <manvolnum>7</manvolnum></citerefentry>.
46+
47+ To disable automatic updates, set to <literal>"never"</literal>
48+ and run <command>updatedb</command> manually.
4649 '';
4750 };
4851
@@ -192,6 +195,18 @@ in {
192195 { LOCATE_PATH = cfg.output;
193196 };
194197
198+ environment.etc = {
199+ # write /etc/updatedb.conf for manual calls to `updatedb`
200+ "updatedb.conf" = {
201+ text = ''
202+ PRUNEFS="${lib.concatStringsSep " " cfg.pruneFS}"
203+ PRUNENAMES="${lib.concatStringsSep " " cfg.pruneNames}"
204+ PRUNEPATHS="${lib.concatStringsSep " " cfg.prunePaths}"
205+ PRUNE_BIND_MOUNTSFR="${lib.boolToString cfg.pruneBindMounts}"
206+ '';
207+ };
208+ };
209+
195210 warnings = optional (isMLocate && cfg.localuser != null) "mlocate does not support the services.locate.localuser option; updatedb will run as root. (Silence with services.locate.localuser = null.)"
196211 ++ optional (isFindutils && cfg.pruneNames != []) "findutils locate does not support pruning by directory component"
197212 ++ optional (isFindutils && cfg.pruneBindMounts) "findutils locate does not support skipping bind mounts";
@@ -238,7 +253,7 @@ in {
238253 serviceConfig.ReadWritePaths = dirOf cfg.output;
239254 };
240255
241− systemd.timers.update-locatedb =
256+ systemd.timers.update-locatedb = mkIf (cfg.interval != "never")
242257 { description = "Update timer for locate database";
243258 partOf = [ "update-locatedb.service" ];
244259 wantedBy = [ "timers.target" ];