472aeafc57
GitOrigin-RevId: c31898adf5a8ed202ce5bea9f347b1c6871f32d1
44 lines
859 B
Nix
44 lines
859 B
Nix
{ 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 = [ ];
|
|
}
|