Nix-Configs/configs/filesystems.nix
2023-07-22 13:31:43 -04:00

52 lines
1.1 KiB
Nix

{ config, lib, pkgs, modulesPath, ... }:
let systemInformation = import ../system/system-information.nix; in
{
boot.tmp.useTmpfs = true;
boot.tmp.tmpfsSize = "75%";
boot.initrd.luks.devices = {
cryptoroot = {
device = systemInformation.rootPartition;
allowDiscards = true;
bypassWorkqueues = true;
};
cryptoswap = {
device = systemInformation.swapPartition;
keyFile = "/crypto_keyfile.bin";
allowDiscards = true;
bypassWorkqueues = true;
};
};
fileSystems = {
"/" = {
device = "/dev/mapper/cryptoroot";
options = [
"defaults"
# Batch journaling commits to 2 minutes for power saving
# https://wiki.archlinux.org/title/Power_management#Writeback_Time
"commit=120"
# Turn on zstd compression
"compress=zstd"
# Performance optimizations for SSD
"noatime"
"nodiratime"
"discard"
];
# Uncomment this once the root fs is actually btrfs
# fsType = "btrfs";
};
"/boot/efi" = {
device = systemInformation.efiPartition;
fsType = "vfat";
};
};
swapDevices = [
{
device = "/dev/mapper/cryptoswap";
discardPolicy = "both";
}
];
}