diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2017-06-07 11:46:17 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2017-06-07 11:46:17 +0200 |
commit | 338cdea33244cca624793150102461827c01e8d2 (patch) | |
tree | 858d0f98dcac9765e316a00549d4298005a80acf /nixos/modules | |
parent | fad6fc3dae16b5161895165bf275e329e20860d6 (diff) | |
parent | a996fe849f669e5d1cafed18f299ed6ed4abec84 (diff) | |
download | nixlib-338cdea33244cca624793150102461827c01e8d2.tar nixlib-338cdea33244cca624793150102461827c01e8d2.tar.gz nixlib-338cdea33244cca624793150102461827c01e8d2.tar.bz2 nixlib-338cdea33244cca624793150102461827c01e8d2.tar.lz nixlib-338cdea33244cca624793150102461827c01e8d2.tar.xz nixlib-338cdea33244cca624793150102461827c01e8d2.tar.zst nixlib-338cdea33244cca624793150102461827c01e8d2.zip |
Merge branch 'master2' of https://github.com/gnidorah/nixpkgs into staging
Diffstat (limited to 'nixos/modules')
-rw-r--r-- | nixos/modules/module-list.nix | 1 | ||||
-rw-r--r-- | nixos/modules/services/misc/fstrim.nix | 45 |
2 files changed, 46 insertions, 0 deletions
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 47adfa334eed..13924f7e507e 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -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 diff --git a/nixos/modules/services/misc/fstrim.nix b/nixos/modules/services/misc/fstrim.nix new file mode 100644 index 000000000000..e89366cbafed --- /dev/null +++ b/nixos/modules/services/misc/fstrim.nix @@ -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" ]; + }; + + }; + +} |