summaryrefslogtreecommitdiff
path: root/machines/kusanagi/default.nix
diff options
context:
space:
mode:
authorHenry J. Webster <hwebs@hwebs.info>2026-07-30 22:47:58 -0500
committerHenry J. Webster <hwebs@hwebs.info>2026-07-30 22:47:58 -0500
commitac7152a1c531e611955861e3fc736e8f55039721 (patch)
treef048ec22dda7663ec7387c854e75958fd4d2fb93 /machines/kusanagi/default.nix
parent8bba2a28a9108a780f4c10986bc9795ad878b299 (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/kusanagi/default.nix')
-rw-r--r--machines/kusanagi/default.nix22
1 files changed, 22 insertions, 0 deletions
diff --git a/machines/kusanagi/default.nix b/machines/kusanagi/default.nix
index c39db8e..bab9acd 100644
--- a/machines/kusanagi/default.nix
+++ b/machines/kusanagi/default.nix
@@ -22,6 +22,28 @@
powerManagement.cpuFreqGovernor = "performance";
+ # --- Idle suspend + Wake-on-LAN ---
+ # Suspend to RAM after 15 min idle instead of running 24/7. While asleep the
+ # servers (Kavita/Immich/Ollama/NFS) are unreachable; wake it with a magic
+ # packet from another LAN host (`wol`/`etherwake <MAC>`, or a phone WoL app) or
+ # a keypress. Tailscale can't wake it directly — the packet is layer-2 LAN-only.
+ #
+ # CAVEAT: swayidle keys off *input* inactivity, not load. A long Ollama
+ # generation or an Immich background job with no keyboard/mouse activity will
+ # still suspend at 15 min. If that bites, add a load/inhibit guard (ask me).
+ networking.interfaces.enp9s0.wakeOnLan.enable = true;
+
+ systemd.user.services.swayidle = {
+ description = "Suspend to RAM 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'";
+ Restart = "on-failure";
+ };
+ };
+
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
# --- GPU (ROCm) ---