From patchwork Mon Feb 5 17:05:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Liliana Marie Prikler X-Patchwork-Id: 60446 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 75F7527BBEA; Sat, 17 Feb 2024 08:26:31 +0000 (GMT) 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_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS 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 974CC27BBE2 for ; Sat, 17 Feb 2024 08:26:30 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rbG14-0006Mf-Cf; Sat, 17 Feb 2024 03:25:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rbG13-0006Jl-DP for guix-patches@gnu.org; Sat, 17 Feb 2024 03:25:45 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rbG13-00075I-53 for guix-patches@gnu.org; Sat, 17 Feb 2024 03:25:45 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rbG1M-0005SC-Ry for guix-patches@gnu.org; Sat, 17 Feb 2024 03:26:04 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68716] [PATCH v5 4/8] services: Extend udev capabilities of gnome-desktop-service. Resent-From: Vivien Kraus Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 17 Feb 2024 08:26:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68716 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68716@debbugs.gnu.org Cc: rg@raghavgururajan.name, Vivien Kraus , Maxim Cournoyer Received: via spool by 68716-submit@debbugs.gnu.org id=B68716.170815834720889 (code B ref 68716); Sat, 17 Feb 2024 08:26:04 +0000 Received: (at 68716) by debbugs.gnu.org; 17 Feb 2024 08:25:47 +0000 Received: from localhost ([127.0.0.1]:60406 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rbG14-0005Qn-JX for submit@debbugs.gnu.org; Sat, 17 Feb 2024 03:25:47 -0500 Received: from mail-ed1-f68.google.com ([209.85.208.68]:52708) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rbG0t-0005P1-Uy for 68716@debbugs.gnu.org; Sat, 17 Feb 2024 03:25:40 -0500 Received: by mail-ed1-f68.google.com with SMTP id 4fb4d7f45d1cf-563a6656c46so4313097a12.1 for <68716@debbugs.gnu.org>; Sat, 17 Feb 2024 00:25:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708158250; x=1708763050; darn=debbugs.gnu.org; h=cc:to:content-transfer-encoding:mime-version:subject:date :references:in-reply-to:message-id:from:from:to:cc:subject:date :message-id:reply-to; bh=FaNHHr3tQ1pZmSq7BDJeYMJLzSa6LK16q5JFFSL7bVY=; b=YcgMxdR0zqwRgFImS5X6rMibT9JFnhNhqY8ImguIAm19eagSL14/BlFBZo1yOhbbnx dtD8rVaSE3/KpuKZUTBD8FYms10zq5I/GfBgsAaPrvTCmpIO9je/JFkCX9IAX642uW7u 8foi6GFku/yxNWvbifA1ZXOjJT2ZpO7TwRDUUE4et+EgbGEi4S58botpT4qL5jsXQrZn p8hcGcl2C5zHehKXwG3HANUbA8Ooe5+PmUqEEiKkZ2Q1/5uCJGQ2RrSKVLDBPhvHMcKs hsf8Dkgy8xjb7cGGNuy4DyZZ1bX0HJSyBBxeCWLRRbxTigplxsLksYW6zFGWUf/DuuT1 XE1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708158250; x=1708763050; h=cc:to:content-transfer-encoding:mime-version:subject:date :references:in-reply-to:message-id:from:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=FaNHHr3tQ1pZmSq7BDJeYMJLzSa6LK16q5JFFSL7bVY=; b=tcwnIkvOlHc8qnwcuLYTHTw1A2Z9RC6RW2FCA47H3F5amIxd7AbIUs5f0KTc1Lb66a GdegGKJ3oR07se+xSSL+mzaN2cNp6Bju6E0rINhkOQocjNvUvzxV7nvQUN/sSetYwvQ8 tGi+pjuK6Vqd2AMg8i3j5sDmCvZtmbgkal6xgywRxzQhD7VZs0UxYNdj7kzfaEFFi9YX 9cvcSMAUSiS2k9/guy0O53BmSt2sBGtRUD80QLAEKypaFfyV9tWc3w99686NRlQJtGE/ K470nFUY33/IIZ7WhQkGhokndNKHfxkWyV9kYL51X4w7dXmI8+GsLTKoR9WaEuB0BwXr aA9A== X-Gm-Message-State: AOJu0Yw7D8JxNSAwjZpQLMVjgD4Eg1lKp8vaQY4nVgVIlO6qQKuf6u3x gXSRp4raRsJgYYNjcjQC/A4Cr6BhmEWvyl/eJk2A6k47gCCv1EttDoiAfTSzb6g= X-Google-Smtp-Source: AGHT+IHWLUoj7hL53ZVp4i2znfwJrVwMzyLzFFeYYBI3Bq7mP8ox9s+5R6CGgKmeL7EnTq2fa7bf4w== X-Received: by 2002:a05:6402:31ee:b0:564:2a5b:93ab with SMTP id dy14-20020a05640231ee00b005642a5b93abmr411255edb.10.1708158250300; Sat, 17 Feb 2024 00:24:10 -0800 (PST) Received: from lumine.fritz.box (85-127-52-93.dsl.dynamic.surfer.at. [85.127.52.93]) by smtp.gmail.com with ESMTPSA id cs1-20020a0564020c4100b005617cebd051sm707218edb.78.2024.02.17.00.24.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 00:24:10 -0800 (PST) From: Vivien Kraus X-Google-Original-From: Vivien Kraus Message-ID: <18430b0ce6613e52113e07ae6305e529270e3265.1708158195.git.liliana.prikler@gmail.com> In-Reply-To: References: Date: Mon, 5 Feb 2024 18:05:41 +0100 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches Our udev service is capable of handling both rules and hardware databases. This patch makes it so that gnome can install any such needed rules or databases, while also allowing users to supply a list of names to ignore (via regular expressions). * gnu/services/desktop.scm (gnome-desktop-configuration): Add udev-ignorelist. (gnome-udev-resources): Rename to… (gnome-udev-configuration-files): … this. Account for udev-ignorelist. (gnome-desktop-service-type): Adjust accordingly. Change-Id: I6df4b896652581c42a35ea3ba1e4849ad72d12ef --- gnu/services/desktop.scm | 54 ++++++++++++++++++++++++++-------------- 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm index 0667acfaba..0631571c49 100644 --- a/gnu/services/desktop.scm +++ b/gnu/services/desktop.scm @@ -82,6 +82,7 @@ (define-module (gnu services desktop) #:use-module (guix ui) #:use-module (guix utils) #:use-module (guix gexp) + #:use-module (guix modules) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:use-module (srfi srfi-35) @@ -147,6 +148,7 @@ (define-module (gnu services desktop) gnome-desktop-configuration-shell gnome-desktop-configuration-utilities gnome-desktop-configuration-extra-packages + gnome-desktop-configuration-udev-ignorelist gnome-desktop-service gnome-desktop-service-type @@ -1417,7 +1419,13 @@ (define-configuration/no-serialization gnome-desktop-configuration "A list of GNOME-adjacent packages to also include. This field is intended for users to add their own packages to their GNOME experience. Note, that it already includes some packages that are considered essential by some (most?) -GNOME users.")) +GNOME users.") + (udev-ignorelist + (list-of-strings '()) + "A list of regular expressions denoting udev rules or hardware file names +provided by any package that should not be installed. By default, every udev +rule and hardware file specified by any package referenced in the other fields +are installed.")) (define (gnome-package gnome name) "Return the package NAME among the GNOME package inputs. NAME can be a @@ -1429,22 +1437,32 @@ (define (gnome-packages gnome names) "Return the package NAMES among the GNOME package inputs." (map (cut gnome-package gnome <>) names)) -(define (gnome-udev-rules config) - "Return the list of GNOME dependencies that provide udev rules." - (let* ((gnome (gnome-desktop-configuration-gnome config)) - (shell (gnome-desktop-configuration-shell config))) - (or (any (match-lambda - ((and pkg (= package-name "gnome-settings-daemon")) - (list pkg)) - (_ #f)) - shell) - (and (maybe-value-set? gnome) - (gnome-packages gnome '("gnome-settings-daemon"))) - (raise - (condition - (&error-location - (location (gnome-desktop-configuration-source-location config))) - (&message (message (G_ "Missing gnome-settings-daemon")))))))) +(define (gnome-udev-configuration-files config) + "Return the GNOME udev rules and hardware files as computed from its +dependencies by filtering out the ignorelist." + (list + (computed-file + "gnome-udev-configurations" + (with-imported-modules + (source-module-closure '((guix build utils) + (guix build union))) + #~(begin + (use-modules (guix build utils) + (guix build union)) + ;; If rules.d or hwdb.d is not a proper directory but a symlink, + ;; then it will not be possible to delete individual files in this + ;; directory. + (union-build #$output + (search-path-as-list + (list "lib/udev" "libexec/udev") + (list #$@(gnome-profile config))) + #:create-all-directories? #t) + (for-each + (lambda (pattern) + (for-each + delete-file-recursively + (find-files #$output pattern))) + (list #$@(gnome-desktop-configuration-udev-ignorelist config)))))))) (define (gnome-polkit-settings config) "Return the list of GNOME dependencies that provide polkit actions and @@ -1487,7 +1505,7 @@ (define gnome-desktop-service-type (name 'gnome-desktop) (extensions (list (service-extension udev-service-type - gnome-udev-rules) + gnome-udev-configuration-files) (service-extension polkit-service-type gnome-polkit-settings) (service-extension profile-service-type