blob: 6e115d99dcd94206391a132558163f05386937cd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.fstrim;
in
{
options = {
services.fstrim = {
enable = (
lib.mkEnableOption "periodic SSD TRIM of mounted partitions in background"
// {
default = true;
}
);
interval = lib.mkOption {
type = lib.types.str;
default = "weekly";
description = ''
How often we run fstrim. For most desktop and server systems
a sufficient trimming frequency is once a week.
The format is described in
{manpage}`systemd.time(7)`.
'';
};
};
};
config = lib.mkIf cfg.enable {
systemd.packages = [ pkgs.util-linux ];
systemd.timers.fstrim = {
timerConfig = {
OnCalendar = [
""
cfg.interval
];
};
wantedBy = [ "timers.target" ];
};
};
meta.maintainers = [ ];
}
|