From 96dc68a349663d38f0846165750acd0e3c3426eb Mon Sep 17 00:00:00 2001 From: Valentin Brandl Date: Mon, 14 Nov 2022 00:19:51 +0100 Subject: [PATCH] Set kernel parameters to allow for hibernation --- machines/morpheus.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/machines/morpheus.nix b/machines/morpheus.nix index c6e11f8..0ef0aec 100644 --- a/machines/morpheus.nix +++ b/machines/morpheus.nix @@ -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" ]; };