diff options
| author | Henry J. Webster <hwebs@hwebs.info> | 2026-07-30 22:47:58 -0500 |
|---|---|---|
| committer | Henry J. Webster <hwebs@hwebs.info> | 2026-07-30 22:47:58 -0500 |
| commit | ac7152a1c531e611955861e3fc736e8f55039721 (patch) | |
| tree | f048ec22dda7663ec7387c854e75958fd4d2fb93 /machines/enzo/default.nix | |
| parent | 8bba2a28a9108a780f4c10986bc9795ad878b299 (diff) | |
enzo/kusanagi: idle suspend via swayidle
Bare niri has no power daemon watching for inactivity, so neither box
slept on its own. Add a user swayidle service bound to
graphical-session.target that fires after 15 min of no input:
- enzo: suspend-then-hibernate (matches the existing lid-switch policy)
- kusanagi: plain suspend-to-RAM, plus Wake-on-LAN on enp9s0 so it can
be woken remotely while the Kavita/Immich/Ollama/NFS servers sleep
Assisted-by: Claude:claude-opus-4-8
Diffstat (limited to 'machines/enzo/default.nix')
| -rw-r--r-- | machines/enzo/default.nix | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/machines/enzo/default.nix b/machines/enzo/default.nix index bcb92cb..7247a3e 100644 --- a/machines/enzo/default.nix +++ b/machines/enzo/default.nix @@ -77,6 +77,23 @@ services.logind.settings.Login.HandleLidSwitch = "suspend-then-hibernate"; systemd.sleep.settings.Sleep.HibernateDelaySec = "60min"; + # Idle trigger. Bare niri has no power daemon watching for inactivity, so with + # the lid open the box never sleeps on its own. swayidle (a Wayland idle + # client) fires the same suspend-then-hibernate after 15 min of no input. niri + # binds it to graphical-session.target and exports WAYLAND_DISPLAY to the user + # manager, so this Just Works in the session. `-w` waits for the resume to + # finish before re-arming the timer. + systemd.user.services.swayidle = { + description = "Suspend-then-hibernate after idle"; + wantedBy = [ "graphical-session.target" ]; + partOf = [ "graphical-session.target" ]; + after = [ "graphical-session.target" ]; + serviceConfig = { + ExecStart = "${pkgs.swayidle}/bin/swayidle -w timeout 900 'systemctl suspend-then-hibernate'"; + Restart = "on-failure"; + }; + }; + # btrfs + SSD upkeep. services.btrfs.autoScrub.enable = true; services.fstrim.enable = true; |
