From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 8LFfOurLRWGfVwAAgWs5BA (envelope-from ) for ; Sat, 18 Sep 2021 13:22:18 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id kDYmNurLRWH6egAA1q6Kng (envelope-from ) for ; Sat, 18 Sep 2021 11:22:18 +0000 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 C60825CFC for ; Sat, 18 Sep 2021 13:22:17 +0200 (CEST) Received: from localhost ([::1]:54758 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRYQC-0001zp-Vf for larch@yhetil.org; Sat, 18 Sep 2021 07:22:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54668) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRYPy-0001zh-OL for guix-patches@gnu.org; Sat, 18 Sep 2021 07:22:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:50408) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mRYPy-0007aa-DE for guix-patches@gnu.org; Sat, 18 Sep 2021 07:22:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mRYPy-0002GW-7G for guix-patches@gnu.org; Sat, 18 Sep 2021 07:22:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49578] [PATCH v3 2/2] services: Add a service for bolt. References: In-Reply-To: Resent-From: phodina Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 18 Sep 2021 11:22: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.16319641108686 (code B ref 49578); Sat, 18 Sep 2021 11:22:02 +0000 Received: (at 49578) by debbugs.gnu.org; 18 Sep 2021 11:21:50 +0000 Received: from localhost ([127.0.0.1]:33721 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mRYPm-0002G2-3V for submit@debbugs.gnu.org; Sat, 18 Sep 2021 07:21:50 -0400 Received: from mail-40134.protonmail.ch ([185.70.40.134]:24888) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mRYPi-0002Fn-Oo for 49578@debbugs.gnu.org; Sat, 18 Sep 2021 07:21:48 -0400 Date: Sat, 18 Sep 2021 11:21:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail; t=1631964096; bh=oE0vEhHG58+QeC/+X28zaw2nVFzLSeU+kI4vldvyXfg=; h=Date:To:From:Cc:Reply-To:Subject:From; b=rx6r3negT5aaYkv/0uDSVtzkf2NSXuzKECUK3tkHQ381JCYTNEQa0VZ0E1xPDOkjS +nM+1JF04NBgFAdGJgZ8LHu6qFWlfoa9sgq5RvNZHxqYFY/QWVzWD/9R4Enk1t9SFI j3ZN2AYdb2lBF96vkI8rYx8GER6aSKrUbFADUJQc= Message-ID: <7hJPvaldH4Bh7rtXByW9GPmxh-s8a1TCz9icV0mkcF6MLy5zRWlgrcruWWbl2KcenTOrIsL89cDh36eBRLrjKa6y53p8a8weWTQpSenjCHE=@protonmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: phodina X-ACL-Warn: , phodina via Guix-patches From: phodina via Guix-patches via X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1631964137; 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=oE0vEhHG58+QeC/+X28zaw2nVFzLSeU+kI4vldvyXfg=; b=dr51w/FkAQy/+9kiOqswg40Zm7G1YYGqZu2Os19t7NpKlWUWVlfti8is+CeJ7xcDJ4a4Tx SoBMlycrxBAc17uM+hkZEjOnQEk4VF+uEFVGJETn9m0oEyv1a3sD1KFZ0D6P1va2vEvayI kVXOCHOfldyP91slxrZfmBf0rA3edTuR+B/C+PV9yxAQbHXSis/vCiZSnk4OFGXdYMjnd1 CtMiHx/P9ord3lFlvS6IImIRbH2CqKIVeLOio8VwDzEcSBODnzac8yT4soHMfI2JivZT6T i9+85EV7OLYniUb/5bZjaYUYN0pjNKDUlMWFRIU6fvC0OTz2JD8FckuPLBW4zA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1631964137; a=rsa-sha256; cv=none; b=UJO5IsYeD/VuqSdHwHhfecS5gT1lY5WlFUBGQDu3Ux8W12ULHn8IFnCO77xh5zXRMWHyxX wtlJSE87Z49B4zBiW6XK9g77DHb6Q2P8X7sjuBcct/aqxxsWI5EODFEoZ0h1+jfurNLIaW Ms194K8o45z3+4fnYxWIa8wrT9z5flgakmOAIv+AOvuKFVWurCMWVNH3jdOJxHzAgot6X0 javQOOCF7Gj2h5rJ5GqssW+xTOLLvJAW9bpTAmBKRU55d5kRRRLA6Ojib9Lt6+X/Aid582 iOnrGIzxXiAo4ErHQW65iE309adZ4r1zz+Ba2+gDCtF4iHt0VBj10MJX/jKVCQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=protonmail.com header.s=protonmail header.b=rx6r3neg; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -1.39 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=protonmail.com header.s=protonmail header.b=rx6r3neg; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: C60825CFC X-Spam-Score: -1.39 X-Migadu-Scanner: scn0.migadu.com X-TUID: zV3MMgOHYRfo * 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 2eb02ac5a3..dc26f285bf 100644 --- a/gnu/services/linux.scm +++ b/gnu/services/linux.scm @@ -4,6 +4,7 @@ ;;; Copyright =C2=A9 2020 Efraim Flashner ;;; Copyright =C2=A9 2021 raid5atemyhomework ;;; Copyright =C2=A9 2021 B. Wilson +;;; Copyright =C2=A9 2021 Petr Hodina ;;; ;;; This file is part of GNU Guix. ;;; @@ -24,7 +25,9 @@ #:use-module (guix gexp) #:use-module (guix records) #:use-module (guix modules) + #:use-module (gnu system shadow) #:use-module (gnu services) + #:use-module (gnu services dbus) #:use-module (gnu services base) #:use-module (gnu services shepherd) #:use-module (gnu packages linux) @@ -33,7 +36,11 @@ #: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 @@ -61,6 +68,76 @@ 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")) +=09=09 )) + (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) +=09=09=09 "libexec/boltd" +=09=09=09 `(("BOLT_CONF_FILE_NAME" +=09=09=09=09 '("share/dbus-1/interfaces/org.freedesktop.bolt.xml")))))) + +(define %bolt-accounts + (list (user-group (name "boltd") (system? #t)) + (user-account +=09 (name "boltd") +=09 (group "boltd") +=09 (system? #t) +=09 (comment "Boltd daemon user") +=09 (home-directory "/var/empty") +=09 (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 +=09=09=09 (compose list bolt-udev-rule)) +=09 (service-extension activation-service-type +=09=09=09 (const %bolt-activation)) +=09 (service-extension dbus-root-service-type +=09 (compose list bolt-configuration-package)) +=09;=09=09 bolt-dbus-service) +=09 (service-extension account-service-type +=09=09=09 (const %bolt-accounts)) + (service-extension shepherd-root-service-type + (compose list bolt-shepherd-service)))) + (default-value (bolt-configuration)))) + ;;; ;;; Early OOM daemon. -- 2.32.0