summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorVladimír Čunát <vcunat@gmail.com>2017-06-11 08:58:57 +0200
committerVladimír Čunát <vcunat@gmail.com>2017-06-11 09:01:08 +0200
commit32916ab1de83642611ea900bdeb951ffb1859343 (patch)
tree5097471fb992bb9e8fdb5090dcaec31e6f7ace79 /nixos
parentd373b7b61af6ad727e5ce40ecd2aacd997271a86 (diff)
parentcb9f953c923eb9fdb1f23458bbc43460f269c5c7 (diff)
downloadnixpkgs-32916ab1de83642611ea900bdeb951ffb1859343.tar
nixpkgs-32916ab1de83642611ea900bdeb951ffb1859343.tar.gz
nixpkgs-32916ab1de83642611ea900bdeb951ffb1859343.tar.bz2
nixpkgs-32916ab1de83642611ea900bdeb951ffb1859343.tar.lz
nixpkgs-32916ab1de83642611ea900bdeb951ffb1859343.tar.xz
nixpkgs-32916ab1de83642611ea900bdeb951ffb1859343.tar.zst
nixpkgs-32916ab1de83642611ea900bdeb951ffb1859343.zip
Merge older staging
Enough rebuilds have finished on Hydra now.
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/module-list.nix1
-rw-r--r--nixos/modules/services/misc/fstrim.nix45
2 files changed, 46 insertions, 0 deletions
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 47adfa334ee..13924f7e507 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 00000000000..e89366cbafe
--- /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" ];
+    };
+
+  };
+
+}