GDM Power Saving in Guix

Problem

I've been experimenting with GNU Guix lately, a potent & multipurpose "distribution of the GNU operating system." I typically use KDE's Plasma as a desktop environment, and Guix offers a plasma package for this, but it's not offered by the installer, being a little more experimental, so I've been using GNOME, but in doing so, I ran into an issue with the default power-saving configuration.

My test device was a laptop left at home, so waking the device while away was not straightforward. My first pass led me to the Power section of GNOME's Settings app, where the 'Automatic Suspend' option can be disabled to prevent suspending after a period of inactivity. I found that even this was not enough to disable suspend altogether. So long as I logged in first, the laptop would not go to sleep, but after updating the system with e.g. guix system reconfigure /etc/config.scm and rebooting, the system would soon enough become inaccessible to remote access.

It turns out this behavior is controlled by GDM. In Debian and other traditional systems, this might be resolved by editing a configuration file in /etc, but Guix is different. Here's the idiomatic fix for the Guix System.

Solution

A default /etc/config.scm will have a (services) section that might look something like this:

;; Below is the list of system services.  To search for available
;; services, run 'guix system search KEYWORD' in a terminal.
(services
 (append (list (service gnome-desktop-service-type)

               ;; To configure OpenSSH, pass an 'openssh-configuration'
               ;; record as a second argument to 'service' below.
               (service openssh-service-type)
               (service network-manager-service-type)
               (service wpa-supplicant-service-type)
               (service ntp-service-type))

         ;; This is the default list of services we
         ;; are appending to.
         %base-services))

Summarizing, we have (services (append (...) %base-services)), where the default GDM configuration is contained within %base-services. Replace %base-services with a call along the lines of (modify-services %desktop-services (config overrides)), specifically setting the gdm-configuration option auto-suspend to #f, like so:

(modify-services %desktop-services
   (gdm-service-type config => (gdm-configuration
      (inherit config)
      (auto-suspend? #f))))

Comments

Comments powered by Disqus