mirror of
https://github.com/Swarsel/.dotfiles.git
synced 2025-12-06 17:17:22 +01:00
31 lines
929 B
Nix
31 lines
929 B
Nix
{ lib, config, ... }:
|
|
{
|
|
options.swarselmodules.optional.hibernation = lib.mkEnableOption "optional amd gpu settings";
|
|
options.swarselsystems = {
|
|
hibernation = {
|
|
offset = lib.mkOption {
|
|
type = lib.types.int;
|
|
default = 0;
|
|
};
|
|
resumeDevice = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "/dev/disk/by-label/nixos";
|
|
};
|
|
};
|
|
};
|
|
config = lib.mkIf config.swarselmodules.optional.hibernation {
|
|
boot = {
|
|
kernelParams = [
|
|
"resume_offset=${builtins.toString config.swarselsystems.hibernation.offset}"
|
|
# "mem_sleep_default=deep"
|
|
];
|
|
inherit (config.swarselsystems.hibernation) resumeDevice;
|
|
};
|
|
systemd.services."systemd-suspend-then-hibernate".aliases = [ "systemd-suspend.service" ];
|
|
powerManagement.enable = true;
|
|
systemd.sleep.extraConfig = ''
|
|
HibernateDelaySec=120m
|
|
SuspendState=freeze
|
|
'';
|
|
};
|
|
}
|