Describe filesystems in config

This commit is contained in:
Emi Simpson 2022-12-18 12:05:43 -05:00
parent 9334e928f7
commit 7241484049
Signed by: Emi
GPG Key ID: A12F2C2FFDC3D847
3 changed files with 48 additions and 0 deletions

42
filesystems.nix Normal file
View File

@ -0,0 +1,42 @@
{ config, lib, pkgs, modulesPath, ... }:
let systemInformation = import ./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"
];
# 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";
}
];
}

View File

@ -14,6 +14,7 @@
#
# Also make sure to move the swap configuration to the hardware config
/etc/nixos/hardware-configuration.nix
./filesystems.nix
<home-manager/nixos>
];

5
system-information.nix Normal file
View File

@ -0,0 +1,5 @@
{
rootPartition = "/dev/disk/by-uuid/850e0a62-fd82-4360-b4d7-258817e86380";
swapPartition = "/dev/disk/by-uuid/6144d426-6c5f-4a8a-ac16-d4d5eecbf7a0";
efiPartition = "/dev/disk/by-uuid/E5A8-38EA";
}