parent
9ff0b303ff
commit
4934f52bb7
@ -3,12 +3,8 @@
|
|||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
cfg = config.services.locate;
|
||||||
locatedb = "/var/cache/locatedb";
|
in {
|
||||||
|
|
||||||
in
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
###### interface
|
###### 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 ];
|
path = [ pkgs.su ];
|
||||||
script =
|
script =
|
||||||
''
|
''
|
||||||
mkdir -m 0755 -p $(dirname ${locatedb})
|
mkdir -m 0755 -p $(dirname ${toString cfg.output})
|
||||||
exec updatedb --localuser=nobody --output=${locatedb} --prunepaths='/tmp /var/tmp /media /run'
|
exec updatedb \
|
||||||
|
--localuser=${cfg.localuser} \
|
||||||
|
--output=${toString cfg.output} ${concatStringsSep " " cfg.extraFlags}
|
||||||
'';
|
'';
|
||||||
serviceConfig.Nice = 19;
|
serviceConfig.Nice = 19;
|
||||||
serviceConfig.IOSchedulingClass = "idle";
|
serviceConfig.IOSchedulingClass = "idle";
|
||||||
|
Loading…
Reference in New Issue
Block a user