From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.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 4BotAOh0RmNm2QAAbAwnHQ (envelope-from ) for ; Wed, 12 Oct 2022 10:03:52 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id UEjrOud0RmMqQAAAG6o9tA (envelope-from ) for ; Wed, 12 Oct 2022 10:03:51 +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 975DD3EBB5 for ; Wed, 12 Oct 2022 10:03:51 +0200 (CEST) Received: from localhost ([::1]:51980 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oiWiU-00024G-Md for larch@yhetil.org; Wed, 12 Oct 2022 04:03:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57998) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiWgl-00023z-DP for guix-patches@gnu.org; Wed, 12 Oct 2022 04:02:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:56504) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oiWgk-0008GJ-Kx for guix-patches@gnu.org; Wed, 12 Oct 2022 04:02:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oiWgk-0007QN-FB for guix-patches@gnu.org; Wed, 12 Oct 2022 04:02:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#58454] [PATCH v2] 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 08:02:02 +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.166556171528518 (code B ref 58454); Wed, 12 Oct 2022 08:02:02 +0000 Received: (at 58454) by debbugs.gnu.org; 12 Oct 2022 08:01:55 +0000 Received: from localhost ([127.0.0.1]:55581 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oiWgd-0007Pt-B3 for submit@debbugs.gnu.org; Wed, 12 Oct 2022 04:01:55 -0400 Received: from knopi.disroot.org ([178.21.23.139]:33124) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oiWgb-0007Pl-Ob for 58454@debbugs.gnu.org; Wed, 12 Oct 2022 04:01:54 -0400 Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 20CA64DABF; Wed, 12 Oct 2022 10:01:53 +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 VA9HiutyP2jZ; Wed, 12 Oct 2022 10:01:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1665561709; bh=5AxVktMPoiSqsLxJIZIK7ZwlRoE97olvik4dphPSuAE=; h=From:To:Cc:Subject:Date; b=N45EF8NCB2KfUdrB5CPpOQ8pAeo3ovovydENKov+EHrSn0yX+dualLwzOF81ATPBQ yKKVSADBvbv1+HnFnIY3q2/hfjn95JoKKD+9jpSUx2v1G6OZDc2pucMZ+h4EhQnO3c R0mtx5W0g4SWX1Y/SpgfXc29o2DMmlnxLnuNITm421tEqSHWuBKVd0dUKo2omq9f0T Lk4PiJJHIxkEj9zcfGRKzuv8oKBhNTX8OSa5GYas/cgiOWuk2du6T/H/hwW/GMb7// 3ejOf8sm2rOD6SKNnLRJ5rBviz4PzfGcQcRNEtV00G15o+AT4GStTwK06MSRxN0qIU 0+Gtk1lYqvbGw== Date: Wed, 12 Oct 2022 09:01:47 +0100 Message-Id: <20221012080147.4971-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=1665561831; 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=G9nGfB9aST1pNsMx1FVibok98GaMfdMsHXA0mt8JXDs=; b=hePCem8a+5uhqANMmybPqis1dlBVjK9b/dLkrUoo5Jqu2/4cj9zAUslGZGmHcYPzbhDA7P KhS1Bw5LJWfYRiQYyYSlFSwYO+FVOSuBcCstfWZJ+4y7HECx8Bedr+KMn3ty46H4jHeqbp 6i/3uqFFDBK/BWzt4XhRF4pCJ2OdhQTVF/UNvhenFSwQqU+X6Z/Ky0xlwSlHcjovD3rJZH QIqP/okz2K5SaFqsTReYyRe3HsX8/pt2icaROYlRazo8J9M5ZVfMQQOSLT16JLHp6fO9aY pB/5sNcZtsrEogZo2SbV1OkBFLoRA5QUQKToUVJsoh3jVwhWzB0YNoN733RuEw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1665561831; a=rsa-sha256; cv=none; b=oZf8qEI/nTwx/VYlCQx9SLUoj16NC1B+OiZCa3Czl3f1B8zk00/3OHMTauzjP3JDS+zy9Q rgIkz6RamGRHKoyuXvzWy41pqDxiRMuXJz/+6YX8MYniuBwxW+TIxToruZhEGLFeWVsAcM n162qY7UNdEZXGR3OajRsVMefMJpj9Dq9koJiY8t1XpoUF5pbOHsEWPFL+WgjO7qCqsZL9 FegrJlja2y+5K01UDMzb+qmK72B/cv0KS7YnVU7TGgkd5YjIPOCudbBUMMpYT/bi5gvQzj N/nUaelS+pcMjn+3VyBtBvvpbjHkE9dGuNZv72uGnpOBZu82GtuaeoRMg2m4uw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=disroot.org header.s=mail header.b=N45EF8NC; 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: -2.90 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=disroot.org header.s=mail header.b=N45EF8NC; 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: 975DD3EBB5 X-Spam-Score: -2.90 X-Migadu-Scanner: scn1.migadu.com X-TUID: kho+CukKHxki * 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 | 58 ++++++++++++++++++++++++++++++++++- 2 files changed, 74 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..20d0724055 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,55 @@ (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" + (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-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