From 3c8510b5d9702f2f58e9da7923a7565941bf6950 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Eug=C3=AAnio?= Date: Wed, 14 Dec 2022 12:40:56 -0300 Subject: [PATCH] monolith: use mout options for ssds --- hosts/monolith.nix | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/hosts/monolith.nix b/hosts/monolith.nix index a6576cd..e6485b5 100644 --- a/hosts/monolith.nix +++ b/hosts/monolith.nix @@ -2,7 +2,9 @@ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. { config, lib, pkgs, modulesPath, ... }: -let btrfs_options = [ "compress=zstd:3" "noatime" ]; +let + btrfs_options = [ "compress=zstd:3" "noatime" ]; + btrfs_ssd = [ "ssd" "discard=async" ]; in { imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; boot.initrd.availableKernelModules = @@ -27,12 +29,18 @@ in { fileSystems."/" = { device = "/dev/disk/by-label/BTRFS_ROOT"; fsType = "btrfs"; - options = [ "subvol=nixos" ]; + options = [ "subvol=nixos" ] ++ btrfs_options ++ btrfs_ssd; }; # boot.initrd.luks.reusePassphrases = true; boot.initrd.luks.devices = { - "main".device = "/dev/disk/by-label/CRYPT_ROOT"; - "data".device = "/dev/disk/by-label/CRYPT_DATA"; + "main" = { + bypassWorkqueues = true; + device = "/dev/disk/by-label/CRYPT_ROOT"; + }; + "data" = { + bypassWorkqueues = true; + device = "/dev/disk/by-label/CRYPT_DATA"; + }; }; fileSystems."/boot/efi" = { device = "/dev/disk/by-label/NIXBOOT"; @@ -41,7 +49,7 @@ in { fileSystems."/home" = { device = "/dev/disk/by-label/BTRFS_ROOT"; fsType = "btrfs"; - options = [ "subvol=home" ] ++ btrfs_options; + options = [ "subvol=home" ] ++ btrfs_options ++ btrfs_ssd; }; fileSystems."/home/lelgenio/Games" = { device = "/dev/disk/by-label/BTRFS_DATA"; @@ -76,9 +84,9 @@ in { fileSystems."/swap" = { device = "/dev/disk/by-label/BTRFS_ROOT"; fsType = "btrfs"; - options = [ - "subvol=swap" - ]; # 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 + # 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 = [{ device = "/swap/swapfile";