nixos: disko: enable hibernation

This commit is contained in:
Guanran Wang 2024-01-17 18:40:06 +08:00
parent 36404f27d3
commit 6c433753c1
Signed by: nyancat
SSH key fingerprint: SHA256:8oWGKciPALWut/6WA27oFKofX+6Wtc0gQnsefXLQx/8

View file

@ -1,4 +1,10 @@
{disks ? ["/dev/sda"], ...}: { {disks ? ["/dev/sda"], ...}: let
mountOptions = ["defaults" "compress=zstd" "noatime"];
cryptSettings = {
allowDiscards = true;
bypassWorkqueues = true;
};
in {
disko.devices = { disko.devices = {
disk = { disk = {
"one" = { "one" = {
@ -17,20 +23,15 @@
mountOptions = ["defaults" "umask=007"]; mountOptions = ["defaults" "umask=007"];
}; };
}; };
"luks" = { "cryptedroot" = {
end = "-16G"; end = "-16G";
content = { content = {
type = "luks"; type = "luks";
name = "crypted"; name = "cryptedroot";
settings = { settings = cryptSettings;
allowDiscards = true;
bypassWorkqueues = true;
};
content = { content = {
type = "btrfs"; type = "btrfs";
subvolumes = let subvolumes = {
mountOptions = ["defaults" "compress=zstd" "noatime"];
in {
"/@nix" = { "/@nix" = {
mountpoint = "/nix"; mountpoint = "/nix";
inherit mountOptions; inherit mountOptions;
@ -43,12 +44,16 @@
}; };
}; };
}; };
"swap" = { "cryptedswap" = {
size = "100%"; end = "-16G";
content = {
type = "luks";
name = "cryptedswap";
settings = cryptSettings;
content = { content = {
type = "swap"; type = "swap";
randomEncryption = true; resumeDevice = true;
#resumeDevice = true; # resume from hiberation from this device };
}; };
}; };
}; };