This commit is contained in:
iFargle 2024-02-06 20:10:48 +09:00
parent 9d62c524de
commit 62009fb603

View file

@ -1,15 +1,9 @@
{ {
imports = [ ../../common/services/snapper.nix ]; imports = [ ../../common/services/snapper.nix ];
services.btrfs.autoScrub.enable = true; services.btrfs.autoScrub.enable = true;
services.btrfs.autoScrub.interval = "weekly"; services.btrfs.autoScrub.interval = "weekly";
boot.resumeDevice = "/dev/disk/by-partlabel/ROOT";
# boot.kernelParams = [ "resume_offset=[offset]" ];
# https://sawyershepherd.org/post/hibernating-to-an-encrypted-swapfile-on-btrfs-with-nixos/
disko.devices.disk.nvme0 = { disko.devices.disk.nvme0 = {
device = "/dev/nvme0n1"; device = "/dev/nvme0n1";
content = { content = {
@ -38,6 +32,7 @@
content = { content = {
type = "luks"; type = "luks";
name = "ROOT"; name = "ROOT";
settings.preLVM = true;
extraOpenArgs = [ "--allow-discards" ]; extraOpenArgs = [ "--allow-discards" ];
content = { content = {
type = "btrfs"; type = "btrfs";
@ -68,15 +63,27 @@
mountpoint = "/nix/.snapshots"; mountpoint = "/nix/.snapshots";
mountOptions = [ "compress=zstd" "noatime" ]; mountOptions = [ "compress=zstd" "noatime" ];
}; # nix }; # nix
# Swap partition
"/swap" = {
mountpoint = "/swap";
swap.swapfile.size = "64G";
}; # swap
}; # subvolumes }; # subvolumes
}; # content.content }; # content.content
}; # content }; # content
} # partition 2 (/ BTRFS) } # partition 2 (/ BTRFS)
{
name = "LUKS-SWAP";
start = "-64GiB";
end = "100%";
content = {
type = "luks";
name = "SWAP";
settings = {
allowDiscards = true;
keyFile = "/mnt-root/etc/swap.key";
}; # content
content = {
type = "swap";
resumeDevice = true; # Hibernation
}; # content.ontent
};# content
} # partition 3 (SWAP)
]; # partitions ]; # partitions
}; # content }; # content
}; # disko.devices.disk.nvme0 }; # disko.devices.disk.nvme0