about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorlethalman <lucabru@src.gnome.org>2014-07-07 14:24:04 +0200
committerlethalman <lucabru@src.gnome.org>2014-07-07 14:24:04 +0200
commite497265b72f423125118636397f6eb738a249c47 (patch)
treebf3e2cdd34842975a56275411afa0ec8f5303331 /nixos
parent1ecae5c2c123c0ca615d011b9ce32f501198e7c4 (diff)
parent4934f52bb7796bbe902b03fe68857b5e67e0d260 (diff)
downloadnixlib-e497265b72f423125118636397f6eb738a249c47.tar
nixlib-e497265b72f423125118636397f6eb738a249c47.tar.gz
nixlib-e497265b72f423125118636397f6eb738a249c47.tar.bz2
nixlib-e497265b72f423125118636397f6eb738a249c47.tar.lz
nixlib-e497265b72f423125118636397f6eb738a249c47.tar.xz
nixlib-e497265b72f423125118636397f6eb738a249c47.tar.zst
nixlib-e497265b72f423125118636397f6eb738a249c47.zip
Merge pull request #2963 from Fuuzetsu/locate
locate service: allow customisation
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/misc/locate.nix39
1 files changed, 31 insertions, 8 deletions
diff --git a/nixos/modules/misc/locate.nix b/nixos/modules/misc/locate.nix
index 45da0df7967c..7de63c606492 100644
--- a/nixos/modules/misc/locate.nix
+++ b/nixos/modules/misc/locate.nix
@@ -3,12 +3,8 @@
 with lib;
 
 let
-
-  locatedb = "/var/cache/locatedb";
-
-in
-
-{
+  cfg = config.services.locate;
+in {
 
   ###### interface
 
@@ -35,6 +31,31 @@ in
         '';
       };
 
+      extraFlags = mkOption {
+        type = types.listOf types.str;
+        default = [ ];
+        description = ''
+          Extra flags to append to <command>updatedb</command>.
+        '';
+      };
+
+      output = mkOption {
+        type = types.path;
+        default = /var/cache/locatedb;
+        description = ''
+          The database file to build.
+        '';
+      };
+
+      localuser = mkOption {
+        type = types.str;
+        default = "nobody";
+        description = ''
+          The user to search non-network directories as, using
+          <command>su</command>.
+        '';
+      };
+
     };
 
   };
@@ -48,8 +69,10 @@ in
         path  = [ pkgs.su ];
         script =
           ''
-            mkdir -m 0755 -p $(dirname ${locatedb})
-            exec updatedb --localuser=nobody --output=${locatedb} --prunepaths='/tmp /var/tmp /media /run'
+            mkdir -m 0755 -p $(dirname ${toString cfg.output})
+            exec updatedb \
+            --localuser=${cfg.localuser} \
+            --output=${toString cfg.output} ${concatStringsSep " " cfg.extraFlags}
           '';
         serviceConfig.Nice = 19;
         serviceConfig.IOSchedulingClass = "idle";