ooknet/inputs/system/modules/base/host/hardware/features/ssd.nix

23 lines
453 B
Nix

{ lib, config, ... }:
let
features = config.systemModules.host.hardware.features;
inherit (lib) mkIf;
inherit (builtins) elem;
in
{
config = mkIf (elem "ssd" features) {
services.fstrim = {
enable = true;
};
# only run fstrim while connected on AC
systemd.services.fstrim = {
unitConfig.ConditionACPower = true;
serviceConfig = {
Nice = 19;
IOSchedulingClass = "idle";
};
};
};
}