Commit 7d8f1572 authored by Jörg Thalheim's avatar Jörg Thalheim
Browse files

nixos: enable fstrim by default

The majority of users these days will install NixOS on SSD/NVME based
storage. Enabling fstrim ensures that the TRIM operation on this type of
storage is run at least once a week. This will improve performance and
life time of said devices. This also works in virtual machines as
formats such as qcow2 or vmdk support TRIM.
Ubuntu has a similar systemd timer also for quite a while enabled by
default.
Enabling this service will not increase the dependency closure as
util-linux is already part of the base system.
In case only filesystems that are not supported by fstrim are used, the
overhead is negelible as fstrim run in less than a second once a week.
parent 51a8ed13
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -8,7 +8,9 @@ in {
  options = {

    services.fstrim = {
      enable = lib.mkEnableOption "periodic SSD TRIM of mounted partitions in background";
      enable = (lib.mkEnableOption "periodic SSD TRIM of mounted partitions in background" // {
        default = true;
      });

      interval = lib.mkOption {
        type = lib.types.str;