nixos-config/modules/ssd.nix

33 lines
679 B
Nix
Raw Normal View History

2020-12-05 15:33:36 +01:00
{ config, lib, ... }:
let
cfg = config.sbruder.ssd;
in
2020-10-17 13:14:42 +02:00
{
2020-12-05 15:33:36 +01:00
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;
};
2020-10-17 13:14:42 +02:00
}