Nix/hosts/GPD-WinMax2/hardware/file-systems.nix
2024-08-15 09:50:34 -04:00

79 lines
1.8 KiB
Nix

{ ... }:
{
boot.initrd.luks.devices = {
"home".device = "/dev/disk/by-uuid/9f2d5272-46ca-403f-ae36-7a60e51fc284";
"root".device = "/dev/disk/by-uuid/07df5dda-8e3d-4d1c-b652-d3d3b03003fc";
};
fileSystems =
let
btrfsSubvol = subvol: [ "subvol=${subvol}" "compress=zstd" ];
ssdOptions = [ "discard=async" "noatime" ];
homeDevice = "/dev/mapper/home";
rootDevice = "/dev/mapper/root";
in
{
"/" = {
# TODO: Switch to tmpfs
device = rootDevice;
fsType = "btrfs";
options = btrfsSubvol "root" ++ ssdOptions;
};
"/boot" = {
device = "/dev/disk/by-uuid/14BC-77E5";
fsType = "vfat";
options = [ "umask=0077" ]; # Restrict access to random seed
};
"/home" = {
device = homeDevice;
fsType = "btrfs";
options = btrfsSubvol "home" ++ ssdOptions;
};
"/nix" = {
device = rootDevice;
fsType = "btrfs";
options = btrfsSubvol "nix" ++ ssdOptions;
};
"/persist" = {
device = rootDevice;
fsType = "btrfs";
neededForBoot = true;
options = btrfsSubvol "persist" ++ ssdOptions;
};
"/swap" = {
device = rootDevice;
fsType = "btrfs";
options = btrfsSubvol "swap" ++ ssdOptions;
};
};
services.snapper.configs = {
home = {
SUBVOLUME = "/home";
TIMELINE_CLEANUP = true;
TIMELINE_CREATE = true;
TIMELINE_LIMIT_DAILY = "7";
TIMELINE_LIMIT_HOURLY = "6";
TIMELINE_LIMIT_MONTHLY = "3";
TIMELINE_LIMIT_WEEKLY = "4";
};
persist = {
SUBVOLUME = "/persist";
TIMELINE_CLEANUP = true;
TIMELINE_CREATE = true;
TIMELINE_LIMIT_WEEKLY = "4";
};
};
swapDevices = [{
device = "/swap/swapfile";
size = 8 * 1024;
}];
}