diff options
Diffstat (limited to 'machines')
| -rw-r--r-- | machines/enzo/default.nix | 17 | ||||
| -rw-r--r-- | machines/kusanagi/default.nix | 22 |
2 files changed, 39 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; 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) --- |
