lol

Merge pull request #2963 from Fuuzetsu/locate

locate service: allow customisation

lethalman e497265b 1ecae5c2

+31 -8
+31 -8
nixos/modules/misc/locate.nix
··· 3 3 with lib; 4 4 5 5 let 6 - 7 - locatedb = "/var/cache/locatedb"; 8 - 9 - in 10 - 11 - { 6 + cfg = config.services.locate; 7 + in { 12 8 13 9 ###### interface 14 10 ··· 35 31 ''; 36 32 }; 37 33 34 + extraFlags = mkOption { 35 + type = types.listOf types.str; 36 + default = [ ]; 37 + description = '' 38 + Extra flags to append to <command>updatedb</command>. 39 + ''; 40 + }; 41 + 42 + output = mkOption { 43 + type = types.path; 44 + default = /var/cache/locatedb; 45 + description = '' 46 + The database file to build. 47 + ''; 48 + }; 49 + 50 + localuser = mkOption { 51 + type = types.str; 52 + default = "nobody"; 53 + description = '' 54 + The user to search non-network directories as, using 55 + <command>su</command>. 56 + ''; 57 + }; 58 + 38 59 }; 39 60 40 61 }; ··· 48 69 path = [ pkgs.su ]; 49 70 script = 50 71 '' 51 - mkdir -m 0755 -p $(dirname ${locatedb}) 52 - exec updatedb --localuser=nobody --output=${locatedb} --prunepaths='/tmp /var/tmp /media /run' 72 + mkdir -m 0755 -p $(dirname ${toString cfg.output}) 73 + exec updatedb \ 74 + --localuser=${cfg.localuser} \ 75 + --output=${toString cfg.output} ${concatStringsSep " " cfg.extraFlags} 53 76 ''; 54 77 serviceConfig.Nice = 19; 55 78 serviceConfig.IOSchedulingClass = "idle";