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: 60424 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 0730C27BBE9; Fri, 16 Feb 2024 12:45:00 +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 72C3527BBE2 for ; Fri, 16 Feb 2024 12:44:58 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1raxaB-00007P-Av; Fri, 16 Feb 2024 07:44:47 -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 1raxa7-00006J-QD for guix-patches@gnu.org; Fri, 16 Feb 2024 07:44:44 -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 1raxa7-0004Qj-I0 for guix-patches@gnu.org; Fri, 16 Feb 2024 07:44:43 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1raxaQ-0008DM-MD; Fri, 16 Feb 2024 07:45:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68716] [PATCH gnome-team v4 4/7] services: Extend udev capabilities of gnome-desktop-service. Resent-From: Vivien Kraus Original-Sender: "Debbugs-submit" Resent-CC: liliana.prikler@gmail.com, maxim.cournoyer@gmail.com, rg@raghavgururajan.name, vivien@planete-kraus.eu, guix-patches@gnu.org Resent-Date: Fri, 16 Feb 2024 12:45:02 +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: liliana.prikler@gmail.com, maxim.cournoyer@gmail.com, rg@raghavgururajan.name, vivien@planete-kraus.eu X-Debbugs-Original-Xcc: liliana.prikler@gmail.com, maxim.cournoyer@gmail.com, rg@raghavgururajan.name, vivien@planete-kraus.eu Received: via spool by 68716-submit@debbugs.gnu.org id=B68716.170808747231482 (code B ref 68716); Fri, 16 Feb 2024 12:45:02 +0000 Received: (at 68716) by debbugs.gnu.org; 16 Feb 2024 12:44:32 +0000 Received: from localhost ([127.0.0.1]:57990 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raxZv-0008Bh-QK for submit@debbugs.gnu.org; Fri, 16 Feb 2024 07:44:32 -0500 Received: from mail-ej1-f68.google.com ([209.85.218.68]:44231) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raxZq-0008Aj-M9 for 68716@debbugs.gnu.org; Fri, 16 Feb 2024 07:44:28 -0500 Received: by mail-ej1-f68.google.com with SMTP id a640c23a62f3a-a26fa294e56so301197666b.0 for <68716@debbugs.gnu.org>; Fri, 16 Feb 2024 04:44:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708087382; x=1708692182; darn=debbugs.gnu.org; h=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=XWaIUZ36t973lYYI9WQgKlVMnlkmOwdbg5wqtjeLYSF4xW9YmUepYMG06RYy7kKyPj 3izuPyaq4wIUD4QrgzpC2ene5+PHbEM46tEcUk5YjIjRSI8zMvVrRH//Op+RNync+Cjr fg4K6SPW3fh1YRZSuwo9sl3XY1YWp8XtabZWPetTcJWYtzHDg1ddoq8vDZWS9LTocl8+ 56Yh4Tc3sI34vABU07IBFBWEOs6UHi8YM8HZ1I5OYiMBWNKiBxijlcVin1AryR8w9h53 kaLx7AHHzcuSh+ztmDlQOtGF1swcJ2o8G8MKDn9kGbNq2FnqN5SZpf5hkibRDjTq6ETI OqJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708087382; x=1708692182; h=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=iLIx2yuj1hDF/lWA3YPhozGvQnwK7OvuKwyH6qnD6DjvTo/HexfjadDZ/WFlgNCywG +oggG6/7Q2VvOFNfdr7MVZuXcm1LXFs1NliKlAy6bK1g7bq42bt7Rfstwy38GD5T3F8R lQL5L6ocET3G3a3dIjt3eOlXokvVsspESLSBPRVF6WwmOHQGrHwaWZAH293mdqOfokuV +K9RRDk76aCmtRXf0064FQbkVCCdKIRExJKCFX960aYoA/dZ00hWgvn0zhRmgH8qYnza Y++MZk714ejxpnEbojza61tLUvgFRIPNLm1aYhyvrcHqKZIqDGJFhbEkHoD46dwddEH1 wSWQ== X-Gm-Message-State: AOJu0YwvHzopr4Grt8llg6TIAPwvSpeo+BzU/UJuPYzZWMg+LHq2mwLD qotR6fzENtnU+apFNdPuLTnG4mpMv9dU5THjaCDXIwRViGBMPO5XnslIyTWaOXs= X-Google-Smtp-Source: AGHT+IEmh/SYqShYuf/CRjmLbsLOjVVEnPN3tuYP6H9q0Y7mz9ReVcnzzSa0E+Mf5CULEF7e7K50zQ== X-Received: by 2002:a17:907:b9c6:b0:a3d:2e34:30a5 with SMTP id xa6-20020a170907b9c600b00a3d2e3430a5mr3238926ejc.29.1708087381722; Fri, 16 Feb 2024 04:43:01 -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 hw12-20020a170907a0cc00b00a3d5d8ff745sm1544090ejc.144.2024.02.16.04.43.00 for <68716@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 04:43:01 -0800 (PST) From: Vivien Kraus X-Google-Original-From: Vivien Kraus Message-ID: In-Reply-To: <5e0b95c296a3abfe2da6c1828dfbbc1a47886083.1708087345.git.liliana.prikler@gmail.com> References: <5e0b95c296a3abfe2da6c1828dfbbc1a47886083.1708087345.git.liliana.prikler@gmail.com> 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