1 { config, lib, pkgs, ... }:
4 cfg = config.services.fstrim;
11 enable = (lib.mkEnableOption "periodic SSD TRIM of mounted partitions in background" // {
15 interval = lib.mkOption {
19 How often we run fstrim. For most desktop and server systems
20 a sufficient trimming frequency is once a week.
22 The format is described in
23 {manpage}`systemd.time(7)`.
30 config = lib.mkIf cfg.enable {
32 systemd.packages = [ pkgs.util-linux ];
34 systemd.timers.fstrim = {
36 OnCalendar = [ "" cfg.interval ];
38 wantedBy = [ "timers.target" ];
43 meta.maintainers = [ ];