mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 13:40:28 +03:00
fstrim: Add service
This commit is contained in:
parent
1d56c2fa43
commit
a996fe849f
3 changed files with 50 additions and 4 deletions
|
@ -283,6 +283,7 @@
|
|||
./services/misc/etcd.nix
|
||||
./services/misc/felix.nix
|
||||
./services/misc/folding-at-home.nix
|
||||
./services/misc/fstrim.nix
|
||||
./services/misc/gammu-smsd.nix
|
||||
./services/misc/geoip-updater.nix
|
||||
#./services/misc/gitit.nix
|
||||
|
|
45
nixos/modules/services/misc/fstrim.nix
Normal file
45
nixos/modules/services/misc/fstrim.nix
Normal file
|
@ -0,0 +1,45 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.services.fstrim;
|
||||
|
||||
in {
|
||||
|
||||
options = {
|
||||
|
||||
services.fstrim = {
|
||||
enable = mkEnableOption "periodic SSD TRIM of mounted partitions in background";
|
||||
|
||||
interval = mkOption {
|
||||
type = types.string;
|
||||
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
|
||||
<citerefentry><refentrytitle>systemd.time</refentrytitle>
|
||||
<manvolnum>7</manvolnum></citerefentry>.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
systemd.packages = [ pkgs.utillinux ];
|
||||
|
||||
systemd.timers.fstrim = {
|
||||
timerConfig = {
|
||||
OnCalendar = cfg.interval;
|
||||
};
|
||||
wantedBy = [ "timers.target" ];
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue