Fix hibernation

The resumeDevice and kernel `resume` parameter were being used wrong.

Only `boot.resumeDevice` is necessary, and it should point at the _block
device_ that holds the swapfile. If you are running on encrypted
volumes, this means you will need to use the name of the *decrypted
block device* on which the swapfile sits.
This commit is contained in:
Benjamin Bädorf 2022-08-24 18:43:11 +02:00
parent 80e71ca547
commit dc8257f31f
No known key found for this signature in database
GPG key ID: 4406E80E13CD656C
2 changed files with 4 additions and 7 deletions

View file

@ -13,7 +13,7 @@ in
resumeDevice = mkOption { resumeDevice = mkOption {
type = types.str; type = types.str;
default = "/swapfile"; default = "/dev/sda1";
description = "The location of the hibernation resume swap file."; description = "The location of the hibernation resume swap file.";
}; };
@ -27,12 +27,9 @@ in
config = { config = {
boot = mkIf cfg.enable { boot = mkIf cfg.enable {
resumeDevice = cfg.resumeDevice; resumeDevice = cfg.resumeDevice;
kernelParams = [ kernelParams =
"resume=${cfg.resumeDevice}"
] ++ (
if (cfg.resumeOffset == null && cfg.enable) then builtins.abort "config.pub-solar.resumeOffset has to be set if config.pub-solar.enable is true." if (cfg.resumeOffset == null && cfg.enable) then builtins.abort "config.pub-solar.resumeOffset has to be set if config.pub-solar.enable is true."
else [ "resume_offset=${cfg.resumeOffset}" ] else [ "resume_offset=${builtins.toString cfg.resumeOffset}" ];
);
}; };
}; };
} }

View file

@ -4,7 +4,7 @@
bindsym $mod+0 mode "$mode_system" bindsym $mod+0 mode "$mode_system"
mode "$mode_system" { mode "$mode_system" {
bindsym e exec swaymsg exit, mode "default" bindsym e exec swaymsg exit, mode "default"
'' + (if !psCfg.core.hibernation.enable then '' '' + (if psCfg.core.hibernation.enable then ''
bindsym h exec systemctl hibernate, mode "default" bindsym h exec systemctl hibernate, mode "default"
'' else "") '' else "")
+ (if !psCfg.paranoia.enable then '' + (if !psCfg.paranoia.enable then ''