summary refs log tree commit diff
diff options
context:
space:
mode:
authorGregor Kleen <pngwjpgh@users.noreply.github.com>2017-01-26 12:56:53 +0100
committerGregor Kleen <pngwjpgh@users.noreply.github.com>2017-01-26 12:56:53 +0100
commit114e738e41aa88d63bb86d3c6bf8ff55729d4908 (patch)
treea8a7d3273ee0fe856d65e6eaf10b9262d30019e2
parent142696de884213e01cc518af813a20d2e2ece3cc (diff)
downloadnixlib-114e738e41aa88d63bb86d3c6bf8ff55729d4908.tar
nixlib-114e738e41aa88d63bb86d3c6bf8ff55729d4908.tar.gz
nixlib-114e738e41aa88d63bb86d3c6bf8ff55729d4908.tar.bz2
nixlib-114e738e41aa88d63bb86d3c6bf8ff55729d4908.tar.lz
nixlib-114e738e41aa88d63bb86d3c6bf8ff55729d4908.tar.xz
nixlib-114e738e41aa88d63bb86d3c6bf8ff55729d4908.tar.zst
nixlib-114e738e41aa88d63bb86d3c6bf8ff55729d4908.zip
locate: better mlocate support & cleanup
-rw-r--r--nixos/modules/misc/locate.nix12
-rw-r--r--nixos/modules/rename.nix3
2 files changed, 6 insertions, 9 deletions
diff --git a/nixos/modules/misc/locate.nix b/nixos/modules/misc/locate.nix
index 3cb5bb1a351a..938c2d4401e5 100644
--- a/nixos/modules/misc/locate.nix
+++ b/nixos/modules/misc/locate.nix
@@ -18,6 +18,7 @@ in {
     locate = mkOption {
       type = types.package;
       default = pkgs.findutils;
+      defaultText = "pkgs.findutils";
       example = "pkgs.mlocate";
       description = ''
         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 {
       type = types.listOf types.str;
       default = [ ];
@@ -58,7 +56,7 @@ in {
     };
 
     localuser = mkOption {
-      type = types.str;
+      type = types.nullOr types.str;
       default = "nobody";
       description = ''
         The user to search non-network directories as, using
@@ -76,10 +74,6 @@ in {
   };
 
   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 =
       { description = "Update Locate Database";
         path  = [ pkgs.su ];
@@ -87,7 +81,7 @@ in {
           ''
             mkdir -m 0755 -p $(dirname ${toString cfg.output})
             exec ${cfg.locate}/bin/updatedb \
-              --localuser=${cfg.localuser} \
+              ${optionalString (cfg.localuser != null) ''--localuser=${cfg.localuser}''} \
               ${optionalString (!cfg.includeStore) "--prunepaths='/nix/store'"} \
               --output=${toString cfg.output} ${concatStringsSep " " cfg.extraFlags}
           '';
diff --git a/nixos/modules/rename.nix b/nixos/modules/rename.nix
index 8d3c0a66ef43..5b4ac07199d8 100644
--- a/nixos/modules/rename.nix
+++ b/nixos/modules/rename.nix
@@ -168,6 +168,9 @@ with lib;
     # dhcpd
     (mkRenamedOptionModule [ "services" "dhcpd" ] [ "services" "dhcpd4" ])
 
+    # locate
+    (mkRenamedOptionModule [ "services" "locate" "period" ] [ "services" "locate" "interval" ])
+
     # Options that are obsolete and have no replacement.
     (mkRemovedOptionModule [ "boot" "initrd" "luks" "enable" ] "")
     (mkRemovedOptionModule [ "programs" "bash" "enable" ] "")