forked from pub-solar/os
Add parameter for swapfile offset
This commit is contained in:
parent
ba6dfdcf53
commit
46992c46d6
|
@ -22,6 +22,18 @@ in
|
|||
default = false;
|
||||
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 = {
|
||||
|
@ -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;
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
{ psCfg, ... }: ''
|
||||
# Set shut down, restart and locking features
|
||||
set $mode_system (e)xit, (h)ibernate, (r)eboot, (Shift+s)hutdown
|
||||
bindsym $mod+0 mode "$mode_system"
|
||||
mode "$mode_system" {
|
||||
# Set shut down, restart and locking features
|
||||
set $mode_system (e)xit, (h)ibernate, (r)eboot, (Shift+s)hutdown
|
||||
bindsym $mod+0 mode "$mode_system"
|
||||
mode "$mode_system" {
|
||||
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"
|
||||
'' else "")
|
||||
+ (if !psCfg.paranoia.enable then ''
|
||||
+ (if !psCfg.paranoia.enable then ''
|
||||
bindsym l exec swaylock-bg, mode "default"
|
||||
bindsym s exec systemctl suspend, mode "default"
|
||||
'' else "") + ''
|
||||
|
@ -17,5 +17,5 @@ mode "$mode_system" {
|
|||
# exit system mode: "Enter" or "Escape"
|
||||
bindsym Return mode "default"
|
||||
bindsym Escape mode "default"
|
||||
}
|
||||
}
|
||||
''
|
||||
|
|
Loading…
Reference in a new issue