From patchwork Sun Aug 14 22:00:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: phodina X-Patchwork-Id: 41680 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 1474E27BBEA; Sun, 14 Aug 2022 23:02:31 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 4EB5427BBE9 for ; Sun, 14 Aug 2022 23:02:30 +0100 (BST) Received: from localhost ([::1]:53472 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oNLgj-0001jo-Cd for patchwork@mira.cbaines.net; Sun, 14 Aug 2022 18:02:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43942) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oNLfL-0001jc-Nm for guix-patches@gnu.org; Sun, 14 Aug 2022 18:01:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:50264) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oNLfK-0006aP-D7 for guix-patches@gnu.org; Sun, 14 Aug 2022 18:01:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oNLfK-0005ah-6S for guix-patches@gnu.org; Sun, 14 Aug 2022 18:01:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49578] [PATCH v4] gnu: Add bolt. Resent-From: phodina Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 14 Aug 2022 22:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49578 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Sarah Morgensen Cc: 49578@debbugs.gnu.org Received: via spool by 49578-submit@debbugs.gnu.org id=B49578.166051445521472 (code B ref 49578); Sun, 14 Aug 2022 22:01:02 +0000 Received: (at 49578) by debbugs.gnu.org; 14 Aug 2022 22:00:55 +0000 Received: from localhost ([127.0.0.1]:40013 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oNLfC-0005aF-E8 for submit@debbugs.gnu.org; Sun, 14 Aug 2022 18:00:55 -0400 Received: from mail-40133.protonmail.ch ([185.70.40.133]:62533) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oNLf6-0005Zx-LF for 49578@debbugs.gnu.org; Sun, 14 Aug 2022 18:00:52 -0400 Date: Sun, 14 Aug 2022 22:00:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1660514441; x=1660773641; bh=0dpdhIOIA/iLrgfNLyDwOYRZRubsnOJqe1/ed8S6ggk=; h=Date:To:From:Cc:Reply-To:Subject:Message-ID:In-Reply-To: References:Feedback-ID:From:To:Cc:Date:Subject:Reply-To: Feedback-ID:Message-ID; b=AWmmQ+vvAP0Oe3ltDxH2+BxskcjqS+pb0RUxIY7xXPXXh7GcU294/ouk7NlPgXD2S XhAltVb3DPj1+qBp4/9AePymrO/rVvkVaDhg/Z9rnBarj0nG/XL6N2IQzmEfoXGiEd JDRDkHkOP0W4SeC5Fz0a9TZfdYIDWpLE0MJzR6/MFwW5PE4b4M0Gum1lf232wzE/F3 hGaitKXMYOoAFyv1LX1lxd18Tm4cl03E6uCDlRjXfTuNLeltym85SzaV8UvLymScGP IOnr1Tk4/GnPPA+1ygYQngHmBVAthNZaMNeq9cH9wzAy/kyy6cGeUzReL9UOQpQfv3 yJJmAK6OEASzw== Message-ID: In-Reply-To: References: <86mto4w0xw.fsf@mgsn.dev> Feedback-ID: 14143818:user:proton MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" Reply-to: phodina X-ACL-Warn: , phodina via Guix-patches X-Patchwork-Original-From: phodina via Guix-patches via From: phodina X-getmail-retrieved-from-mailbox: Patches Hi Sarah, here's updated patch with your tips. David, the way I test new packages is either by running: [1] guix shell --check --pure -D guix or [2] guix build -L [1] https://guix.gnu.org/manual/en/html_node/Invoking-guix-environment.html [2] https://guix.gnu.org/manual/en/html_node/Common-Build-Options.html ---- Petr From e054c89f9964686670e7716c820ca9ebb9f41543 Mon Sep 17 00:00:00 2001 From: Petr Hodina Date: Sat, 18 Sep 2021 13:11:18 +0200 Subject: [PATCH v4 2/2] services: Add a service for bolt. * gnu/services/linux.scm (bolt-service-type) (bolt-shepherd-service, bolt-dbus-service) (bolt-configuration, bolt-configuration?): New procedures. diff --git a/gnu/services/linux.scm b/gnu/services/linux.scm index 60e2093e1d..37dcd14f97 100644 --- a/gnu/services/linux.scm +++ b/gnu/services/linux.scm @@ -5,6 +5,7 @@ ;;; Copyright © 2021 raid5atemyhomework ;;; Copyright © 2021 B. Wilson ;;; Copyright © 2022 Josselin Poiret +;;; Copyright © 2021-2022 Petr Hodina ;;; ;;; This file is part of GNU Guix. ;;; @@ -29,15 +30,21 @@ (define-module (gnu services linux) #:use-module (guix i18n) #:use-module (guix ui) #:use-module (gnu services) + #:use-module (gnu services dbus) #:use-module (gnu services base) #:use-module (gnu services shepherd) + #:use-module (gnu system shadow) #:use-module (gnu packages linux) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:use-module (srfi srfi-34) #:use-module (srfi srfi-35) #:use-module (ice-9 match) - #:export (earlyoom-configuration + #:export (bolt-configuration + bolt-configuration? + bolt-service-type + + earlyoom-configuration earlyoom-configuration? earlyoom-configuration-earlyoom earlyoom-configuration-minimum-available-memory @@ -65,6 +72,76 @@ (define-module (gnu services linux) zram-device-configuration-priority zram-device-service-type)) + +;;; +;;; Thunderbolt daemon. +;;; + +(define-record-type* + bolt-configuration make-bolt-configuration bolt-configuration? + (package bolt-configuration-package ; package + (default bolt))) + +(define bolt-shepherd-service + (match-lambda + (($ package) + (with-imported-modules (source-module-closure + '((gnu build shepherd))) + (shepherd-service + (documentation "Thunderbolt daemon") + (provision '(thunderbolt)) + (requirement '(networking)) + (modules '((gnu build shepherd))) + (start #~(make-forkexec-constructor/container + (list #$(file-append package "/libexec/boltd")) + )) + (stop #~(make-kill-destructor))))))) + +(define %bolt-activation + #~(begin + (use-modules (guix build utils)) + (mkdir-p "/var/lib/boltd"))) + +(define (bolt-dbus-service config) + (list (wrapped-dbus-service (bolt-configuration-bolt config) + "libexec/boltd" + `(("BOLT_CONF_FILE_NAME" + '("share/dbus-1/interfaces/org.freedesktop.bolt.xml")))))) + +(define %bolt-accounts + (list (user-group (name "boltd") (system? #t)) + (user-account + (name "boltd") + (group "boltd") + (system? #t) + (comment "Boltd daemon user") + (home-directory "/var/empty") + (shell "/run/current-system/profile/sbin/nologin")))) + +(define bolt-udev-rule + (match-lambda + (($ package) + (file->udev-rule "90-bolt.rules" (file-append package "/lib/udev/rules.d/90-bolt.rules"))))) + +(define bolt-service-type + (service-type + (name 'boltd) + (description + "Thunderbolt daemon") + (extensions + (list (service-extension udev-service-type + (compose list bolt-udev-rule)) + (service-extension activation-service-type + (const %bolt-activation)) + (service-extension dbus-root-service-type + (compose list bolt-configuration-package)) + ; bolt-dbus-service) + (service-extension account-service-type + (const %bolt-accounts)) + (service-extension shepherd-root-service-type + (compose list bolt-shepherd-service)))) + (default-value (bolt-configuration)))) + ;;; ;;; Early OOM daemon. -- 2.37.0