Nix-Configs/configs/filesystems.nix
2023-01-31 22:05:43 -05:00

55 lines
1.1 KiB
Nix

{ config, lib, pkgs, modulesPath, ... }:
let systemInformation = import ../system/system-information.nix; in
{
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"
# Performance optimizations for SSD
"noatime"
"nodiratime"
"discard"
];
# Uncomment this once the root fs is actually btrfs
# fsType = "btrfs";
};
"/tmp" = {
device = "none";
fsType = "tmpfs";
options = [
"size=75%"
"mode=777"
];
};
"/boot/efi" = {
device = systemInformation.efiPartition;
fsType = "vfat";
};
};
swapDevices = [
{
device = "/dev/mapper/cryptoswap";
discardPolicy = "both";
}
];
}