summary refs log tree commit diff
path: root/nixos/modules/tasks
diff options
context:
space:
mode:
authorIvan Petkov <ivanppetkov@gmail.com>2021-01-15 20:20:23 -0800
committerIvan Petkov <ivanppetkov@gmail.com>2021-01-15 20:23:16 -0800
commite2fa74dc68d5f6fcedcf63aa9d64e488eff2b985 (patch)
tree450c5cbe071d98f9e7709f8ea3f2695796919001 /nixos/modules/tasks
parent495066a47fc259aa4fc5f7548e190fded2c7030e (diff)
downloadnixpkgs-e2fa74dc68d5f6fcedcf63aa9d64e488eff2b985.tar
nixpkgs-e2fa74dc68d5f6fcedcf63aa9d64e488eff2b985.tar.gz
nixpkgs-e2fa74dc68d5f6fcedcf63aa9d64e488eff2b985.tar.bz2
nixpkgs-e2fa74dc68d5f6fcedcf63aa9d64e488eff2b985.tar.lz
nixpkgs-e2fa74dc68d5f6fcedcf63aa9d64e488eff2b985.tar.xz
nixpkgs-e2fa74dc68d5f6fcedcf63aa9d64e488eff2b985.tar.zst
nixpkgs-e2fa74dc68d5f6fcedcf63aa9d64e488eff2b985.zip
nixos/zfs: make zpool-trim timer persistent
If the machine is powered off when the zpool-trim timer is supposed to
trigger (usually around midnight) then the timer will be skipped
outright in favor of the next instance.

For desktop systems which are usually powered off at this time, zpool
trimming will never be run which can degrade SSD performance.

By marking the timer as `Persistent = yes` we ensure that it will run at
the first possible opportunity after the trigger date is reached.
Diffstat (limited to 'nixos/modules/tasks')
-rw-r--r--nixos/modules/tasks/filesystems/zfs.nix2
1 files changed, 2 insertions, 0 deletions
diff --git a/nixos/modules/tasks/filesystems/zfs.nix b/nixos/modules/tasks/filesystems/zfs.nix
index 6becc696273..9638a7cb3e5 100644
--- a/nixos/modules/tasks/filesystems/zfs.nix
+++ b/nixos/modules/tasks/filesystems/zfs.nix
@@ -664,6 +664,8 @@ in
         # - There are only HDDs and we would set the system in a degraded state
         serviceConfig.ExecStart = ''${pkgs.runtimeShell} -c 'for pool in $(zpool list -H -o name); do zpool trim $pool;  done || true' '';
       };
+
+      systemd.timers.zpool-trim.timerConfig.Persistent = "yes";
     })
   ];
 }