nixos-config/modules/ssd.nix

33 lines
679 B
Nix

{ config, lib, ... }:
let
cfg = config.sbruder.ssd;
in
{
options.sbruder.ssd = {
enable = lib.mkEnableOption "ssd optimisations";
fileSystems = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ "/" ];
description = "List of file systems to apply optimisations to";
};
};
config = lib.mkIf cfg.enable {
fileSystems = builtins.listToAttrs
(builtins.map
(fs: {
name = fs;
value = {
options = [
"discard"
"noatime"
"nodiratime"
];
};
})
cfg.fileSystems);
services.fstrim.enable = true;
};
}