Nix-Configs/configs/filesystems.nix

47 lines
1.0 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";
};
"/boot/efi" = {
device = systemInformation.efiPartition;
fsType = "vfat";
};
};
swapDevices = [
{
device = "/dev/mapper/cryptoswap";
discardPolicy = "both";
}
];
}