Add parameter for swapfile offset
This commit is contained in:
parent
ba6dfdcf53
commit
46992c46d6
|
@ -22,6 +22,18 @@ in
|
||||||
default = false;
|
default = false;
|
||||||
description = "Whether the device can hibernate. This creates a swapfile at /swapfile.";
|
description = "Whether the device can hibernate. This creates a swapfile at /swapfile.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
resumeDevice = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "/swapfile";
|
||||||
|
description = "The location of the hibernation resume swap file.";
|
||||||
|
};
|
||||||
|
|
||||||
|
resumeOffset = mkOption {
|
||||||
|
type = types.nullOr types.number;
|
||||||
|
default = null;
|
||||||
|
description = "The swap file offset. Can be found by running `filefrag -v $swap_file_location`. See https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate#Hibernation_into_swap_file";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
@ -38,7 +50,14 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
resumeDevice = mkIf cfg.hibernation.enable "/swapfile";
|
|
||||||
|
resumeDevice = mkIf cfg.hibernation.enable cfg.hibernation.resumeDevice;
|
||||||
|
kernelParams = mkIf cfg.hibernation.enable [
|
||||||
|
"resume=${cfg.hibernation.resumeDevice}"
|
||||||
|
] ++ (
|
||||||
|
if (cfg.hibernation.resumeOffset == null) then builtins.abort "config.pub-solar.hibernation.resumeOffset has to be set if config.pub-solar.hibernation.enable is true."
|
||||||
|
else [ "resume_offset=${cfg.hibernation.resumeOffset}" ]
|
||||||
|
);
|
||||||
|
|
||||||
loader.systemd-boot.enable = true;
|
loader.systemd-boot.enable = true;
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ set $mode_system (e)xit, (h)ibernate, (r)eboot, (Shift+s)hutdown
|
||||||
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.allow-hibernation 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 ''
|
||||||
|
|
Loading…
Reference in a new issue