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