Nix-Configs/configs/filesystems.nix

52 lines
1.1 KiB
Nix

{ config, lib, pkgs, modulesPath, ... }:
let systemInformation = import ../system/system-information.nix; in
{
boot.tmpOnTmpfs = true;
boot.tmpOnTmpfsSize = "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";
}
];
}