From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id uO0DFe4+LWPpwgAAbAwnHQ (envelope-from ) for ; Fri, 23 Sep 2022 07:06:54 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id mOwLFe4+LWOWWQAA9RJhRA (envelope-from ) for ; Fri, 23 Sep 2022 07:06:54 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 06468277AF for ; Fri, 23 Sep 2022 07:06:53 +0200 (CEST) Received: from localhost ([::1]:37644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obatn-0005rz-6j for larch@yhetil.org; Fri, 23 Sep 2022 01:06:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33206) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obaq6-00040h-SD for guix-patches@gnu.org; Fri, 23 Sep 2022 01:03:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39975) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1obaq6-0002Em-IC for guix-patches@gnu.org; Fri, 23 Sep 2022 01:03:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1obaq6-00057j-C8 for guix-patches@gnu.org; Fri, 23 Sep 2022 01:03:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#58014] [PATCH 14/15] services: xorg: Add auto-suspend? field to . Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 23 Sep 2022 05:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58014 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 58014@debbugs.gnu.org Cc: Maxim Cournoyer Received: via spool by 58014-submit@debbugs.gnu.org id=B58014.166390933219632 (code B ref 58014); Fri, 23 Sep 2022 05:03:02 +0000 Received: (at 58014) by debbugs.gnu.org; 23 Sep 2022 05:02:12 +0000 Received: from localhost ([127.0.0.1]:39051 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1obapI-00056Y-8a for submit@debbugs.gnu.org; Fri, 23 Sep 2022 01:02:12 -0400 Received: from mail-qt1-f180.google.com ([209.85.160.180]:44841) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1obapD-00054K-35 for 58014@debbugs.gnu.org; Fri, 23 Sep 2022 01:02:07 -0400 Received: by mail-qt1-f180.google.com with SMTP id f26so7741118qto.11 for <58014@debbugs.gnu.org>; Thu, 22 Sep 2022 22:02:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=vuq0hriT3+MgMFrP0QkAVley/t4x1B0R+S/83oneL4I=; b=VdcrYqUDwG8KbqsFPCYOwMJvSdx/W/5805kaqQNm25aFyYthv3GahFuFHcU22x5tl/ 2FoOEBrT0ni7/FplwPxadHdiiPSfjC1dzr3g8SaI2dvQv8syOpkJxlO+hGPLKSOMUwmm W6NnOhbMnBzMZg1CF1Qo5KLikUqCayUwV4jOUk+mRnA5hjtfjgY6YGMn3dZOd4hkrm0M Y/pRqXlxOp9xq+brkk9eyB+LaIt8RcB1tOnZU1vl6jILsD3k+g8NHe8xCgPrxbYRe8Y2 2HkH8Aj1mztDBjYLPjyON7LzxOCraxdiYEQbSrYrIeEPPVZAlJ4iUJhE/LPgGn1CjUbc s1UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=vuq0hriT3+MgMFrP0QkAVley/t4x1B0R+S/83oneL4I=; b=ZQZO+3zVqkXRbcdT2nKxTysBlRaq9aio+wXO5yPBf2wJJI/jzS1DY4XjgMHrlHXy66 sPSkiTuPVYeZACCev+ObKE4QRDJytAeF3dslHnvQDUx1m4xCwb+gLtE3vfCfHBdA52FZ srBPX2yTVP34UHk/HoSJmT/9VD3akrzMHCmI/UsefcP0c49vQfi/9GE1pHvQiTd+mLXm aEM2fUJzxBMzYO7U8cl/7g/xW3y/2tPCWPxhHgIM8clhNQm7F/Tl6LeLL1y0dJO1K6pa L0SyklfOS9SSf0nkCUxctB5W1hkq0ze8wD1lHdMN+hAZ8XeeR3MA6s6fIGZSkVp3+htN V/fQ== X-Gm-Message-State: ACrzQf3tYQDBfpfEIT0JzE7DemVjzkWlVK8S4fnKbPWNcr+MC8mFfbUy RV3weBaPU0VjXfJoHkuv3hA95HtkESc= X-Google-Smtp-Source: AMsMyM6vzg1vytYUI3NfeFitCp0PKDdFgwvyYLjcD+dPwLmt7AdeqqNqW9Ws7WY8W51ASmga1uQ9kg== X-Received: by 2002:a05:622a:301:b0:35c:fca2:4641 with SMTP id q1-20020a05622a030100b0035cfca24641mr5807411qtw.206.1663909321397; Thu, 22 Sep 2022 22:02:01 -0700 (PDT) Received: from localhost.localdomain ([2607:fad8:4:3::1001]) by smtp.gmail.com with ESMTPSA id de4-20020a05620a370400b006bbb07ebd83sm5263534qkb.108.2022.09.22.22.02.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Sep 2022 22:02:01 -0700 (PDT) From: Maxim Cournoyer Date: Fri, 23 Sep 2022 01:00:41 -0400 Message-Id: <20220923050042.29893-14-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220923050042.29893-1-maxim.cournoyer@gmail.com> References: <20220923050042.29893-1-maxim.cournoyer@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1663909614; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=vuq0hriT3+MgMFrP0QkAVley/t4x1B0R+S/83oneL4I=; b=pfqNhX4/SUw8ed/aBAVcLEKbOyqpgil9LjFIViOfHBDDtvL8cl3lLj5IvbP3JkL8I5mvku mjdPwPLnO6sZkwTVVwAs529v7dy6XxUy9WalH5oLDyhe/rAOLkftfIQNYGdAbMCJ3HEkYT QKFlQoHLbzK5a4AKcClkAXWU9ZTYeBI/VW/0Zz9ezAbdqWckwPOpaMnyQJDeIY2/iLJNDm 7nSm43NDOYIE/GjwiWvRgEIEk8uyIgasnZRJ024bgKwo9RhsULI40Dac1uszZR2otJeeIK 1Te+gTbPwWrz1NxEYT0tT/HdghOnpuuv8BkMhLBJ6DD87qjqYB/6plqrcagvDg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1663909614; a=rsa-sha256; cv=none; b=kuerylSVw2vMVPiuRi3EDBffMZXcA2uRd7JbaCweKY3ARojt2UyTFxgjxVW7IKIsGn589z P9tuW6caouxiNnh49fUOcfmUIF4IwEyZCWg35T1yARd9QybNX9Ee2q2Ku/ZaF+GdRqh/OW KreYVgltiuyXtB0CmmBnLyxn4gzJd2rEw8g/Ss6y0lQDs1zIwippL8bWwESF4CtcGhGJUF HN9QU17YrWpt7VSBqz5i0afwHC0sUknuZ4vqhv5pklxrqXezjX1yWtXutxbjMhqJV5hyli clTA3xAc12j+vq9YCJvywi6UE0dklFbz4ho9mvBdt584hMXop2GdaydrEPJChQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=VdcrYqUD; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 8.15 X-Spam: Yes Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=VdcrYqUD; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 06468277AF X-Spam-Score: 8.15 X-Migadu-Spam: Yes X-Migadu-Scanner: scn1.migadu.com X-TUID: xmKpU5NmrtbA * gnu/services/xorg.scm () : New field. (gdm-dconf-profiles): New variable. * gnu/services/xorg.scm (gdm-shepherd-service) [!auto-suspend?]: Specify DCONF_PROFILE. (gdm-service-type): Extend DCONF-SERVICE-TYPE. * doc/guix.texi (X Window): Document the new field. --- doc/guix.texi | 6 ++++++ gnu/services/xorg.scm | 32 +++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index be1f2e0063..b04ec25399 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -21050,6 +21050,12 @@ When @code{auto-login?} is false, GDM presents a log-in screen. When @code{auto-login?} is true, GDM logs in directly as @code{default-user}. +@item @code{auto-suspend?} (default @code{#t}) +When true, GDM will automatically suspend to RAM when nobody is +physically connected. When a machine is used via remote desktop or SSH, +this should be set to false to avoid GDM interrupting remote sessions or +rendering the machine unavailable. + @item @code{debug?} (default: @code{#f}) When true, GDM writes debug messages to its log. diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm index 9205c6f9f4..902fef0058 100644 --- a/gnu/services/xorg.scm +++ b/gnu/services/xorg.scm @@ -986,6 +986,7 @@ (define-record-type* (gdm gdm-configuration-gdm (default gdm)) (allow-empty-passwords? gdm-configuration-allow-empty-passwords? (default #t)) (auto-login? gdm-configuration-auto-login? (default #f)) + (auto-suspend? gdm-configuration-auto-suspend? (default #t)) (dbus-daemon gdm-configuration-dbus-daemon (default dbus-daemon-wrapper)) (debug? gdm-configuration-debug? (default #f)) (default-user gdm-configuration-default-user (default #f)) @@ -1001,6 +1002,30 @@ (define-record-type* (wayland-session gdm-configuration-wayland-session (default gdm-wayland-session-wrapper))) +(define (gdm-dconf-profiles config) + (if (gdm-configuration-auto-suspend? config) + '() + ;; This custom gconf profile works around a lack of configuration option + ;; to disable auto-suspend when no users are physically logged in (see: + ;; https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/22). + (list (dconf-profile + (name "gdm") + (content (list #~(begin + (use-modules (ice-9 textual-ports)) + (string-trim + (call-with-input-file + #$(file-append gdm "/share/dconf/profile/gdm") + get-string-all))) + "system-db:gdm")) + (keyfile (dconf-keyfile + (name "00-disable-suspend") + (content + (list "[org/gnome/settings-daemon/plugins/power]" + "sleep-inactive-ac-type='nothing'" + "sleep-inactive-battery-type='nothing'" + "sleep-inactive-ac-timeout=0" + "sleep-inactive-battery-timeout=0")))))))) + (define (gdm-configuration-file config) (mixed-text-file "gdm-custom.conf" "[daemon]\n" @@ -1073,7 +1098,10 @@ (define (gdm-shepherd-service config) (list #$(file-append (gdm-configuration-gdm config) "/bin/gdm")) #:environment-variables - (list (string-append + (list #$@(if (gdm-configuration-auto-suspend? config) + #~() + #~("DCONF_PROFILE=/etc/dconf/profile/gdm")) + (string-append "GDM_CUSTOM_CONF=" #$(gdm-configuration-file config)) (string-append @@ -1152,6 +1180,8 @@ (define gdm-service-type gdm-shepherd-service) (service-extension account-service-type (const %gdm-accounts)) + (service-extension dconf-service-type + gdm-dconf-profiles) (service-extension pam-root-service-type gdm-pam-service) (service-extension polkit-service-type -- 2.37.3