depot/third_party/nixpkgs/nixos/modules/services/misc/fstrim.nix
Default email 159e378cbb Project import generated by Copybara.
GitOrigin-RevId: c04d5652cfa9742b1d519688f65d1bbccea9eb7e
2024-09-19 17:19:46 +03:00

42 lines
820 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";
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 = [ ];
}