ooknet/nixos/modules/host/hardware/features/ssd.nix
2024-06-11 22:37:17 +12:00

23 lines
446 B
Nix

{ lib, config, ... }:
let
features = config.ooknet.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";
};
};
};
}