Fix no-sleep module to skip desktop role

Agent-Logs-Url: https://github.com/naturallaw777/staging_alpha/sessions/d008099d-2fd3-4b86-a10c-ed7f9337e51c

Co-authored-by: naturallaw777 <99053422+naturallaw777@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-04-22 12:37:36 +00:00
committed by GitHub
parent e147fd8f4d
commit 448c4b9094

View File

@@ -1,6 +1,9 @@
# ── modules/core/no-sleep.nix ───────────────────────────────────────────────── # ── modules/core/no-sleep.nix ─────────────────────────────────────────────────
# Prevents the machine from ever sleeping or suspending at the system level. # Prevents the machine from ever sleeping or suspending at the system level.
# #
# Only applies to server_plus_desktop and node roles. Desktop-only installs
# retain normal OS sleep/suspend behaviour.
#
# This operates at two layers below GNOME: # This operates at two layers below GNOME:
# 1. systemd-logind — ignores all hardware power events (lid, suspend key, etc.) # 1. systemd-logind — ignores all hardware power events (lid, suspend key, etc.)
# 2. systemd targets — masks sleep/suspend/hibernate targets so nothing can # 2. systemd targets — masks sleep/suspend/hibernate targets so nothing can
@@ -9,27 +12,30 @@
# This is intentional for a 24/7 server/node. The GNOME-layer power settings in # This is intentional for a 24/7 server/node. The GNOME-layer power settings in
# sovran_systemsos-desktop.nix remain in place as a belt-and-suspenders complement # sovran_systemsos-desktop.nix remain in place as a belt-and-suspenders complement
# for active user sessions. # for active user sessions.
{ ... }: { config, lib, ... }:
{ {
# ── Layer 1: logind hardware event handling ──────────────────────────────── config = lib.mkIf (!config.sovran_systemsOS.roles.desktop) {
services.logind = {
lidSwitch = "ignore";
lidSwitchDocked = "ignore";
lidSwitchExternalPower = "ignore";
settings.Login = {
HandleSuspendKey = "ignore";
HandleHibernateKey = "ignore";
HandlePowerKey = "ignore";
IdleAction = "ignore";
IdleActionSec = 0;
};
};
# ── Layer 2: mask systemd sleep targets ─────────────────────────────────── # ── Layer 1: logind hardware event handling ──────────────────────────────
# Nothing on the system can suspend/hibernate — not root, not GNOME, not D-Bus. services.logind = {
systemd.targets.sleep.enable = false; lidSwitch = "ignore";
systemd.targets.suspend.enable = false; lidSwitchDocked = "ignore";
systemd.targets.hibernate.enable = false; lidSwitchExternalPower = "ignore";
systemd.targets.hybrid-sleep.enable = false; settings.Login = {
HandleSuspendKey = "ignore";
HandleHibernateKey = "ignore";
HandlePowerKey = "ignore";
IdleAction = "ignore";
IdleActionSec = 0;
};
};
# ── Layer 2: mask systemd sleep targets ─────────────────────────────────
# Nothing on the system can suspend/hibernate — not root, not GNOME, not D-Bus.
systemd.targets.sleep.enable = false;
systemd.targets.suspend.enable = false;
systemd.targets.hibernate.enable = false;
systemd.targets.hybrid-sleep.enable = false;
};
} }