1
0
Fork 0

System: replace weekly trim with continuous trim (SSDs)

This commit is contained in:
Aires 2024-08-24 12:39:04 -04:00
parent 21c3e5cb51
commit 442c39550d
2 changed files with 10 additions and 15 deletions

View file

@ -22,6 +22,11 @@ in
default = "";
};
};
discard = lib.mkOption {
type = lib.types.bool;
description = "Whether to enable TRIM for SSD and NVMe drives. Defaults to true.";
default = true;
};
swapFile = {
enable = lib.mkEnableOption (lib.mdDoc "Enables the creation of a swap file.");
size = lib.mkOption {
@ -59,7 +64,7 @@ in
options = [
"subvol=@"
"compress=zstd"
];
] ++ lib.optionals cfg.discard [ "discard=async" ];
};
"/boot" = {
device = cfg.partitions.boot;
@ -71,7 +76,7 @@ in
options = [
"subvol=@home"
"compress=zstd"
];
] ++ lib.optionals cfg.discard [ "discard=async" ];
};
"/var/log" = {
device = decryptPath;
@ -79,7 +84,7 @@ in
options = [
"subvol=@log"
"compress=zstd"
];
] ++ lib.optionals cfg.discard [ "discard=async" ];
};
"/nix" = {
device = decryptPath;
@ -88,7 +93,7 @@ in
"subvol=@nix"
"compress=zstd"
"noatime"
];
] ++ lib.optionals cfg.discard [ "discard=async" ];
};
}
// lib.optionalAttrs cfg.swapFile.enable {
@ -98,7 +103,7 @@ in
options = [
"subvol=@swap"
"noatime"
];
] ++ lib.optionals cfg.discard [ "discard=async" ];
};
};

View file

@ -53,16 +53,6 @@ in
# Enable fwupd (firmware updater)
fwupd.enable = true;
# Enable trim on supported drives
fstrim.enable = true;
# Autoscrub BTRFS partitions
btrfs.autoScrub = lib.mkIf (config.fileSystems."/".fsType == "btrfs") {
enable = true;
interval = "weekly";
fileSystems = [ "/" ];
};
# Allow systemd user services to keep running after the user has logged out
logind.killUserProcesses = false;