From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id kL58FjvKRWOIIQEAbAwnHQ (envelope-from ) for ; Tue, 11 Oct 2022 21:55:39 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id sGWDFjvKRWMgAQEAauVa8A (envelope-from ) for ; Tue, 11 Oct 2022 21:55:39 +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 F0C0DFD3A for ; Tue, 11 Oct 2022 21:55:37 +0200 (CEST) Received: from localhost ([::1]:54812 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oiLLk-00035L-WE for larch@yhetil.org; Tue, 11 Oct 2022 15:55:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50472) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiLLH-00034h-Oe for guix-patches@gnu.org; Tue, 11 Oct 2022 15:55:07 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:55878) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oiLLC-0001c9-Aq for guix-patches@gnu.org; Tue, 11 Oct 2022 15:55:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oiLLB-0000zZ-V9 for guix-patches@gnu.org; Tue, 11 Oct 2022 15:55:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#58454] [PATCH 1/1] 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: Tue, 11 Oct 2022 19:55: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.16655180863785 (code B ref 58454); Tue, 11 Oct 2022 19:55:01 +0000 Received: (at 58454) by debbugs.gnu.org; 11 Oct 2022 19:54:46 +0000 Received: from localhost ([127.0.0.1]:54956 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oiLKw-0000yz-6j for submit@debbugs.gnu.org; Tue, 11 Oct 2022 15:54:46 -0400 Received: from knopi.disroot.org ([178.21.23.139]:36670) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oiLKs-0000yp-Sc for 58454@debbugs.gnu.org; Tue, 11 Oct 2022 15:54:44 -0400 Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 7352F4C247; Tue, 11 Oct 2022 21:54:41 +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 H-FW8mqwSICf; Tue, 11 Oct 2022 21:54:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1665518080; bh=NvIXPgbKiucY8nUvp3jEx10MLLgGx0Td+Oa8cE/7dHs=; h=From:To:Cc:Subject:Date; b=chM2wald77A5/WJg3YPRCCH/gpKjq3KFaHocCqq6HDKMIOORvplnUOqKy8Ko9V8q7 RJaCjwUNPNoDr506oihDMIKcCpIxm+GdvCBWmq+GCeHt57Xygh75FOHo1Fm+3xpkGA LlY9a2loQRoVvES+j8LKyKapF3P43qucOm3+aaBjMUHeRSFvXou6eaOAd1YyhLi73j Xb9vSKh72Sfysgx5OVEUdeZTY1Yglo+g05jGMyg2VTCf7x7cLCKqPgbTJTvzaH2pgz cEdQfuSqvSvvQC/ZzVU+LhIMHsb/NayOS4wNKtPQe/CNjVH0OShmhBm35tVf69KEQq Hn+JUwdDhNF9w== Date: Tue, 11 Oct 2022 20:54:30 +0100 Message-Id: <20221011195430.26160-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=1665518139; 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=FD77vIEfiX3C6Qd0ZqnyMAHHeZkTecMiSis5zTYoThI=; b=t/uCXoZH3UYxb55N37Faqvri4M0TWV5kEWp9JDWHPYB74YOTfrggTHiZdSewGvUzj04LLh E7ICnPjojA6umiK4NkSmyHGNJqZxDbPtS1QA7/VqWuv2XcPVxQD0eWhLVWv1xZFwYOqi0m XB4cHHMuMx2TTjw2Y7HPtwCe88ZqKpTp71qtH2CRB2hcvsqNbRmOjTsRLNP+OYGO91tAp7 DUALtXgYbVVd1Tzk516FXUp2hKwR7taNbwpdqRHr0An6ESwv0hC/uXuSIBOdoUew0Sp1nX LiIpkdHegbJ6NVROYaokCGGeaDkC79d08p6tsoZNzjdc9VZGGZwMD7j0/b7dBA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1665518139; a=rsa-sha256; cv=none; b=dFbb57tD7TALjJSuLlL6P901Dd7Xty50TKpYy0aPWAvFnYr+LDrsRvtFnFKtlyVEoBbDSQ u21L7e5xgAeWVLwt+ONDmctdkzcKktEPnIeF+IUl6IKm4zdrOpFFVU6f9h9wGIXLVtUNKP AwKEzKkxrFOqpqYXCociUllqpJRXS8Pz2SLLkbqBs+jI4cG9XmMnY4Qf+GUlrN0ZYh7c2C mlh/f6ZpFNsrsizwaIcv7V3oKMyKNBHW7dF55eHjkDkvy84R9nOGrfTCkDT2edlbsJn4od VLtkRT4hmyI7EhU76rE3bMUreR24fU/6SrfrGdM1vfIAPKti8gR2WMauuB3uIQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=disroot.org header.s=mail header.b=chM2wald; 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: -1.89 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=disroot.org header.s=mail header.b=chM2wald; 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: F0C0DFD3A X-Spam-Score: -1.89 X-Migadu-Scanner: scn0.migadu.com X-TUID: yI+iUDA4CeX7 * 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 | 17 ++++++++++++ gnu/home/services/desktop.scm | 52 ++++++++++++++++++++++++++++++++++- 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index 5867acb746..990113703b 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -41262,6 +41262,23 @@ 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. + +@item @code{verbose?} (default: @code{#f}) +Whether to enable logging. +@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..4cf151762d 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,49 @@ (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)) + (verbose? home-dbus-verbose? ;boolean + (default #f))) + +(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" "--syslog-only" + (format #f "--address=unix:path=~a/bus" + (or (getenv "XDG_RUNTIME_DIR") + (format #f "/run/user/~a" + (getuid))))) + #$@(if (home-dbus-verbose? config) + (list #: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-service-type + (service-type + (name 'home-dbus) + (extensions + (list (service-extension home-shepherd-service-type + home-dbus-shepherd-services))) + (default-value (home-dbus-configuration)) + (description + "Run the session-specific D-Bus inter-process message bus."))) -- 2.38.0