monolith: use mout options for ssds

This commit is contained in:
Leonardo Eugênio 2022-12-14 12:40:56 -03:00
parent d88b7bcefb
commit 3c8510b5d9

View file

@ -2,7 +2,9 @@
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }: { config, lib, pkgs, modulesPath, ... }:
let btrfs_options = [ "compress=zstd:3" "noatime" ]; let
btrfs_options = [ "compress=zstd:3" "noatime" ];
btrfs_ssd = [ "ssd" "discard=async" ];
in { in {
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules = boot.initrd.availableKernelModules =
@ -27,12 +29,18 @@ in {
fileSystems."/" = { fileSystems."/" = {
device = "/dev/disk/by-label/BTRFS_ROOT"; device = "/dev/disk/by-label/BTRFS_ROOT";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=nixos" ]; options = [ "subvol=nixos" ] ++ btrfs_options ++ btrfs_ssd;
}; };
# boot.initrd.luks.reusePassphrases = true; # boot.initrd.luks.reusePassphrases = true;
boot.initrd.luks.devices = { boot.initrd.luks.devices = {
"main".device = "/dev/disk/by-label/CRYPT_ROOT"; "main" = {
"data".device = "/dev/disk/by-label/CRYPT_DATA"; bypassWorkqueues = true;
device = "/dev/disk/by-label/CRYPT_ROOT";
};
"data" = {
bypassWorkqueues = true;
device = "/dev/disk/by-label/CRYPT_DATA";
};
}; };
fileSystems."/boot/efi" = { fileSystems."/boot/efi" = {
device = "/dev/disk/by-label/NIXBOOT"; device = "/dev/disk/by-label/NIXBOOT";
@ -41,7 +49,7 @@ in {
fileSystems."/home" = { fileSystems."/home" = {
device = "/dev/disk/by-label/BTRFS_ROOT"; device = "/dev/disk/by-label/BTRFS_ROOT";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=home" ] ++ btrfs_options; options = [ "subvol=home" ] ++ btrfs_options ++ btrfs_ssd;
}; };
fileSystems."/home/lelgenio/Games" = { fileSystems."/home/lelgenio/Games" = {
device = "/dev/disk/by-label/BTRFS_DATA"; device = "/dev/disk/by-label/BTRFS_DATA";
@ -76,9 +84,9 @@ in {
fileSystems."/swap" = { fileSystems."/swap" = {
device = "/dev/disk/by-label/BTRFS_ROOT"; device = "/dev/disk/by-label/BTRFS_ROOT";
fsType = "btrfs"; fsType = "btrfs";
options = [ # Note these options effect the entire BTRFS filesystem and not just this volume,
"subvol=swap" # with the exception of `"subvol=swap"`, the other options are repeated in my other `fileSystem` mounts
]; # Note these options effect the entire BTRFS filesystem and not just this volume, with the exception of `"subvol=swap"`, the other options are repeated in my other `fileSystem` mounts options = [ "subvol=swap" ] ++ btrfs_options ++ btrfs_ssd;
}; };
swapDevices = [{ swapDevices = [{
device = "/swap/swapfile"; device = "/swap/swapfile";