Set kernel parameters to allow for hibernation

This commit is contained in:
Valentin Brandl 2022-11-14 00:19:51 +01:00
parent 1d622b7000
commit 96dc68a349
Signed by: vbrandl
GPG Key ID: CAD4DA1A789125F9

View File

@ -2,6 +2,7 @@ inputs:
let
system = "x86_64-linux";
hostname = "morpheus";
swapUUID = "93bdadfc-961a-4ea6-aef0-d3cd50847f0b";
in
inputs.nixpkgs.lib.nixosSystem {
inherit system;
@ -71,6 +72,13 @@ inputs.nixpkgs.lib.nixosSystem {
kernelModules = [ "kvm-amd" ];
# use latest kernel
kernelPackages = pkgs.linuxPackages_latest;
kernelParams = [
/* enable hibernation with swapfile */
/* https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate#Hibernation_into_swap_file */
("resume=UUID=" + swapUUID)
/* sudo filefrag -v /swap/swapfile | awk '$1=="0:" {print substr($4, 1, length($4)-2)}' */
"resume_offset=269568"
];
kernel.sysctl = {
# function keys on keychron keyboard won't work otherwise
"module.hid_apple.parameters.fnmode" = "2";
@ -113,7 +121,7 @@ inputs.nixpkgs.lib.nixosSystem {
};
fileSystems."/swap" =
{ device = "/dev/disk/by-uuid/93bdadfc-961a-4ea6-aef0-d3cd50847f0b";
{ device = "/dev/disk/by-uuid/" + swapUUID;
fsType = "btrfs";
options = [ "subvol=swap" "noatime" ];
};