From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.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 sI06KC8iR2P5DQAAbAwnHQ (envelope-from ) for ; Wed, 12 Oct 2022 22:23:11 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id YChUKC8iR2NczAAAauVa8A (envelope-from ) for ; Wed, 12 Oct 2022 22:23:11 +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 2A7383E785 for ; Wed, 12 Oct 2022 22:23:11 +0200 (CEST) Received: from localhost ([::1]:36404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oiiFx-00056S-Od for larch@yhetil.org; Wed, 12 Oct 2022 16:23:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50076) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiiEs-0004VN-8T for guix-patches@gnu.org; Wed, 12 Oct 2022 16:22:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:59425) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oiiEr-0002jU-Sz for guix-patches@gnu.org; Wed, 12 Oct 2022 16:22:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oiiEr-0004AG-Hx for guix-patches@gnu.org; Wed, 12 Oct 2022 16:22:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#58454] [PATCH v3] gnu: home: Add home-dbus-service-type. References: <20221011194513.26008-1-paren@disroot.org> In-Reply-To: <20221011194513.26008-1-paren@disroot.org> Resent-From: "(" Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 12 Oct 2022 20:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58454 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 58454@debbugs.gnu.org Cc: "\(" Received: via spool by 58454-submit@debbugs.gnu.org id=B58454.166560611115992 (code B ref 58454); Wed, 12 Oct 2022 20:22:01 +0000 Received: (at 58454) by debbugs.gnu.org; 12 Oct 2022 20:21:51 +0000 Received: from localhost ([127.0.0.1]:58503 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oiiEh-00049r-7Z for submit@debbugs.gnu.org; Wed, 12 Oct 2022 16:21:51 -0400 Received: from knopi.disroot.org ([178.21.23.139]:33268) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oiiEe-00049i-PH for 58454@debbugs.gnu.org; Wed, 12 Oct 2022 16:21:50 -0400 Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 2E8414DAE3; Wed, 12 Oct 2022 22:21:47 +0200 (CEST) X-Virus-Scanned: SPAM Filter at disroot.org Received: from knopi.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id erdCwQ4L6kuS; Wed, 12 Oct 2022 22:21:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1665606105; bh=XjXXUYSL9JuXeWyUBLOhGDSVcOkZLh11+xyf4GoQWYY=; h=From:To:Cc:Subject:Date; b=NW19+dGQH9IvGzVZ67URpi96zHGf1F/MszE2mrj+IBIRtwAZte4sHZNz1cu3Dv1Jd pV59AknIGQ0DEvXfvME3IDXdoJ1WAOtSCTGem5eA9DHQo3q0SGV0tAHGwMhK82DtFd XvnT62gpSckrVMmWN8fOhHzRwXBvWnVRXwDH3ruR8w7ZycYg21Lo6qMqLPv9qrxpDz eL2aWGBjC2fy8tkFGz5O8G3h9yEGs6wElMVIj+O9fbsOmBJeL1MuD8dzZcx1xtSjog WB/GrDwAmCA6uV7j5s8qg3K+SjpDHhtBaAN4py84XYOvvLhXth8kUE6eU9RYwTMu+T 0vStxBmp47Acg== Date: Wed, 12 Oct 2022 21:21:39 +0100 Message-Id: <20221012202139.8379-1-paren@disroot.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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" Reply-to: "\(" X-ACL-Warn: , "\( via Guix-patches" From: "\( via Guix-patches" via X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1665606191; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: 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=7u4ZxaiuX+syqWWXKtLvsB/LPO3pBm0p0KHCGFdem/I=; b=DGz2e0CW9bHP7uqiwAdrmo1NaZ9mUpAABzWq9X3MbSk7DGJtCiRwALfoyAOQ4m3K44Hw3r YZGJ0apGCjxNaYDI3dCTwGwChI575xEPwdyQd32vs0b8nHOYF/PQE3beDyqsBkU0/jFQSS k0wY81chHuPMFsvMvNLJApkIEcQyMyLFxKH88AwkpI/PBXB8x5Jx/FWVxKWxwiuSrMkP0x QIib0WZUOsJBTtmI4OPMC3MbAxW0JwH1DUxlkkUaOsFCwXsIAcSPdYADWX2lVJnJpr0CA6 iQuRxRBvF92OjIB0bhv7MaySYV3Gyf/onNze23B4vUeKKRmEp/4e6dWKVb29Gg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1665606191; a=rsa-sha256; cv=none; b=qyr4dVDTJdHcBcOKPLVs9D3m1iuH9J2VUOjsqhQhReuzK8e++45WqFyFJGC6JihWQetUOM /Zl1DNG/MF4Vz6ncd4OUFQn7JqKO83vYYHHdCtcAkpZnKEzUZ+jfubJM6iT+k/7KTAjG3s Ko8Zyf0zBihB9HjArtykx1Y+wlG+G7EgKyPLDqhSdTLJgbwghDVjTEe3C4KL8Y9XyHBO89 SIYCXdNdqNcCQJkR74+wVLj7WQ6KQy5LPejUGtYI5Naq47dv+MtZyUoByvn0QxU32DqS3s Y/RB3b2eFqP4qzXyKI/UzCBQTRB2KRmNXmTAdF+l5oMrq1fu5waMDLUDSPwnzg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=disroot.org header.s=mail header.b=NW19+dGQ; dmarc=pass (policy=none) header.from=gnu.org; 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: -3.40 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=disroot.org header.s=mail header.b=NW19+dGQ; dmarc=pass (policy=none) header.from=gnu.org; 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: 2A7383E785 X-Spam-Score: -3.40 X-Migadu-Scanner: scn0.migadu.com X-TUID: B2qbQl54N5dJ * gnu/home/services/desktop.scm (home-dbus-service-type): New variable. (home-dbus-configuration): New record type. * doc/guix.texi: Document them. --- doc/guix.texi | 14 +++++++++ gnu/home/services/desktop.scm | 54 ++++++++++++++++++++++++++++++++++- 2 files changed, 67 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index 5867acb746..78ada9c301 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -41262,6 +41262,20 @@ format. @end deftp +@defvr {Scheme Variable} home-dbus-service-type +This is the service type for running a session-specific D-Bus, for +unprivileged applications that require D-Bus to be running. +@end defvr + +@deftp {Data Type} home-dbus-configuration +The configuration record for @code{home-dbus-service-type}. + +@table @asis +@item @code{dbus} (default: @code{dbus}) +The package providing the @code{/bin/dbus-daemon} command. +@end table +@end deftp + @node Guix Home Services @subsection Guix Home Services diff --git a/gnu/home/services/desktop.scm b/gnu/home/services/desktop.scm index b0f4d969b0..1f41ace766 100644 --- a/gnu/home/services/desktop.scm +++ b/gnu/home/services/desktop.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2022 Ludovic Courtès +;;; Copyright © 2022 ( ;;; ;;; This file is part of GNU Guix. ;;; @@ -20,6 +21,7 @@ (define-module (gnu home services desktop) #:use-module (gnu home services) #:use-module (gnu home services shepherd) #:use-module (gnu services configuration) + #:autoload (gnu packages glib) (dbus) #:autoload (gnu packages xdisorg) (redshift) #:use-module (guix records) #:use-module (guix gexp) @@ -27,8 +29,10 @@ (define-module (gnu home services desktop) #:use-module (ice-9 match) #:export (home-redshift-configuration home-redshift-configuration? + home-redshift-service-type - home-redshift-service-type)) + home-dbus-configuration + home-dbus-service-type)) ;;; @@ -172,3 +176,51 @@ (define home-redshift-service-type (description "Run Redshift, a program that adjusts the color temperature of display according to time of day."))) + + +;;; +;;; D-Bus. +;;; + +(define-record-type* + home-dbus-configuration make-home-dbus-configuration + home-dbus-configuration? + (dbus home-dbus-dbus ;file-like + (default dbus))) + +(define (home-dbus-shepherd-services config) + (list (shepherd-service + (documentation "Run the D-Bus daemon in session-specific mode.") + (provision '(dbus-session)) + (start #~(make-forkexec-constructor + (list #$(file-append (home-dbus-dbus config) + "/bin/dbus-daemon") + "--nofork" "--session" "--nosyslog" + (format #f "--address=unix:path=~a/bus" + (or (getenv "XDG_RUNTIME_DIR") + (format #f "/run/user/~a" + (getuid))))) + #:environment-variables + #~(list "DBUS_VERBOSE=1") + #:log-file + (format #f "~a/dbus-daemon.log" + (or (getenv "XDG_LOG_HOME") + (format #f "~a/.local/var/log" + (getenv "HOME")))))) + (stop #~(make-kill-destructor))))) + +(define (home-dbus-environment-variables config) + '(("DBUS_SESSION_BUS_ADDRESS" + . "unix:path=${XDG_RUNTIME_DIR:-/run/user/$UID}/bus"))) + +(define home-dbus-service-type + (service-type + (name 'home-dbus) + (extensions + (list (service-extension home-shepherd-service-type + home-dbus-shepherd-services) + (service-extension home-environment-variables-service-type + home-dbus-environment-variables))) + (default-value (home-dbus-configuration)) + (description + "Run the session-specific D-Bus inter-process message bus."))) -- 2.38.0