Benjamin Bädorf
4c0991c7e1
Hibernation is now a core option: ``` pub-solar.core.hibernation.enable = true; ``` And there's a paranoia mode, that keeps the disk encrypted as much as possible by enabling hibernation and removing the options for sleep, screen locking. Idle locking now hibernates, and it does it on very short notice.
29 lines
851 B
Nix
29 lines
851 B
Nix
{ pkgs, psCfg, ... }:
|
|
{
|
|
Unit = {
|
|
Description = "Idle manager for Wayland";
|
|
Documentation = [ "man:swayidle(1)" ];
|
|
BindsTo = [ "graphical-session.target" ];
|
|
Wants = [ "graphical-session-pre.target" ];
|
|
After = [ "graphical-session-pre.target" ];
|
|
};
|
|
Service = {
|
|
Type = "simple";
|
|
Environment = "PATH=/run/current-system/sw/bin:${pkgs.sway}/bin";
|
|
ExecStart = if psCfg.paranoia.enable then ''
|
|
${pkgs.swayidle}/bin/swayidle -w \
|
|
timeout 120 'swaymsg "output * dpms off"' \
|
|
timeout 150 'systemctl hibernate' \
|
|
'' else ''
|
|
${pkgs.swayidle}/bin/swayidle -w \
|
|
timeout 600 'swaylock-bg' \
|
|
timeout 900 'swaymsg "output * dpms off"' \
|
|
resume 'swaymsg "output * dpms on"' \
|
|
before-sleep 'swaylock-bg'
|
|
'';
|
|
};
|
|
Install = {
|
|
WantedBy = [ "sway-session.target" ];
|
|
};
|
|
}
|