nixpkgs/nixos/modules/services/misc/fstrim.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

46 lines
856 B
Nix
Raw Normal View History

2017-05-30 13:39:27 +00:00
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.fstrim;
in {
options = {
services.fstrim = {
enable = mkEnableOption (lib.mdDoc "periodic SSD TRIM of mounted partitions in background");
interval = mkOption {
type = types.str;
2017-05-30 13:39:27 +00:00
default = "weekly";
description = lib.mdDoc ''
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 = mkIf cfg.enable {
2020-11-24 15:29:28 +00:00
systemd.packages = [ pkgs.util-linux ];
2017-05-30 13:39:27 +00:00
systemd.timers.fstrim = {
timerConfig = {
OnCalendar = [ "" cfg.interval ];
2017-05-30 13:39:27 +00:00
};
wantedBy = [ "timers.target" ];
};
};
meta.maintainers = with maintainers; [ ];
2017-05-30 13:39:27 +00:00
}