From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id IBm8MtA8tmGXXQEAgWs5BA (envelope-from ) for ; Sun, 12 Dec 2021 19:17:52 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 4KE7LtA8tmFEcAAAbx9fmQ (envelope-from ) for ; Sun, 12 Dec 2021 18:17:52 +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 5046C20A3F for ; Sun, 12 Dec 2021 19:17:52 +0100 (CET) Received: from localhost ([::1]:39544 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwTPz-0005cm-EG for larch@yhetil.org; Sun, 12 Dec 2021 13:17:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53582) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwTPo-0005cd-O2 for guix-devel@gnu.org; Sun, 12 Dec 2021 13:17:40 -0500 Received: from dd30410.kasserver.com ([85.13.145.193]:38094) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwTPm-0004ud-4b for guix-devel@gnu.org; Sun, 12 Dec 2021 13:17:40 -0500 Received: from localhost (84-115-234-145.cable.dynamic.surfer.at [84.115.234.145]) by dd30410.kasserver.com (Postfix) with ESMTPSA id A6152112037C; Sun, 12 Dec 2021 19:17:29 +0100 (CET) Date: Sun, 12 Dec 2021 19:17:26 +0100 From: Danny Milosavljevic To: Alexander Asteroth Subject: Re: How to handle package udev rules? Message-ID: <20211212191711.43e4b7d2@scratchpost.org> In-Reply-To: <878rwqf1s4.fsf@h-brs.de> References: <878rwqf1s4.fsf@h-brs.de> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.24; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/BwM+ncN0lx02Kd/J5osWJMM"; protocol="application/pgp-signature"; micalg=pgp-sha512 Received-SPF: none client-ip=85.13.145.193; envelope-from=dannym@scratchpost.org; helo=dd30410.kasserver.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: guix-devel@gnu.org Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1639333072; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=NVgckETZ345fWZDICCqCO3/dHiX0cEKI+tCnJcT6n/E=; b=PhfQk2w4Bh27TF1xfy/GZ/yPZDTuoa6hZq+qxkXPYdR0QOxTpF87xfhZWNHa7p+DedtOlB l06IV9+0oUnFHPS/BeescWR7rmAQi4kCFgkCqKLaciR+eRx4b6PylVRbxz7b8QA/SjI+Yt 1VyRQM9ac79Hdnzg3Qpba6RjDHAXKdW0XWLWyLliy3zt2TwX57vQ3rnNTQYD6sWq2Y7j8k /xMOK33b65d6EG0O91R02AM/IcaLYzOff5UKkUnvO1MwcS/Z7hfTntGhmRS8IqpOAqwMX7 fSAsMZgZAdaI/jA9/dXKwwANr6+fT58SunUIHHjqVjhxwFjfYKyFOPDOKd0WOQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1639333072; a=rsa-sha256; cv=none; b=dUa4UM6wVMPCNFEwPR75k86X2KZowAa3NsYfVsXkPDud0m2gxMYYOK63JKOkIIw17l0dB7 SxU9rvOY8Xg+lWfZUVIc+pQJgcVvHjw2IbgVtEYaAAOFgJbUW124Kho7VRW/1SrZhdR5KZ 3Kjoo3Ko4PDsb4rR4jVQQ+i29LxgedBV4andaUcLkL8DE+hUKFle8tiEPOV67JjaK8OpkM R742srJEM4Je9j50Uagh0RhR+5JExKCF15bS3P7AiG0MUKkE7AXVN//rYwc3uAIiCdWI2E J/mT9NuJMlmuHlWpHyd0qSU7R/NYAz/MJrNQVCd5X7OjDTU+I0ziRTBQ2DbSTA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -4.17 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 5046C20A3F X-Spam-Score: -4.17 X-Migadu-Scanner: scn1.migadu.com X-TUID: 1kbfHZJCflBH --Sig_/BwM+ncN0lx02Kd/J5osWJMM Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hello Alexander, On Sun, 12 Dec 2021 13:12:50 +0100 Alexander Asteroth wrote: > I tried to import the libgudev module but that that only results in the > package wanting to write to another write-protected directory from the > store. It's supposed to write those to $output/lib/udev/rules.d (s.t. there's *.rules inside) instead. There's usually a cmake variable to make it do that--but you need to look at the CMakeLists.txt in question. Guix will pick those up if they originate in something it can see and add those to Guix's udev service automatically (via the service extension mecha= nism, which allows you to extend service config from outside the udev service). Are you using Guix as an operating system? Or on top of another distributio= n? > As I understand, the udev-rules are usually created on system level. Yes. > That would mean I need to split the package into a service part > and a package part? And remove the installation of the udev-file from > the package install process? Kinda not really--at least not exactly. See below. Example I'm using (that one definitely works--but I only add the custom package because the upstream package doesn't do it![1]): /etc/config.scm : (define my-ledger-nano (package (name "my-ledger-nano") (version "1") (source #f) (build-system trivial-build-system) (synopsis "") (description "") (license #f) (home-page #f) (arguments `(#:builder (begin (mkdir %output) (mkdir (string-append %output "/lib")) (mkdir (string-append %output "/lib/udev")) (mkdir (string-append %output "/lib/udev/rules.d")) (call-with-output-file (string-append %output "/lib/udev/rules.d/9= 9-my-ledger-nano.rules") (lambda (port) (format port "SUBSYSTEM=3D=3D\"usb\", ATTRS{idVendor}=3D=3D\"2c97\", MODE=3D\"0600\", OW= NER=3D\"dannym\", TAG+=3D\"uaccess\", TAG+=3D\"udev-acl\" KERNEL=3D=3D\"hidraw*\", ATTRS{idVendor}=3D=3D\"2c97\", MODE=3D\"0600\", OW= NER=3D\"dannym\", SYMLINK+=3D\"ledger_%n\", TAG+=3D\"uaccess\", TAG+=3D\"ud= ev-acl\" "))) #t))))) (operating-system ... (services (simple-service 'custom-udev-rules udev-service-type (list sane= -backends my-ledger-nano))) You can add your package reference there and it will work. Or you can try adding your package reference into (operating-system (packages (list ...)))--should be enough. If you mean adding your package's udev rules to the operating system configuration without being the "root" user in-between: no, that would be a (very bad! those rules run as root!) security problem. In the case of your package, it seems[0] that they calculate the directory = to store the udev rules to from pkg-config--which will result in the udev package's install directory. That won't work. But in line 214 in [0] they seem to allow you to override it anyway. So you can try to call cmake with -DCMAKE_INSTALL_UDEVRULESDIR=3D$output//lib/udev/rules.d like this (in your package definition): (package ... (arguments '(#:configure-flags (list (string-append "-DCMAKE_INSTALL_UDEVRULESDIR=3D" (assoc-ref %outputs "out") "/lib/udev/rules.d")))) [0] https://github.com/jahnf/Projecteur/blob/develop/CMakeLists.txt#L231 [1] https://github.com/LedgerHQ/udev-rules/pull/8 --Sig_/BwM+ncN0lx02Kd/J5osWJMM Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAmG2PLYACgkQ5xo1VCww uqVOegf/ZEVvV+ybTeWHk1GcnvkpMoNm8aBcjipwbm79167gwGJY8sfz625cor6T k3McFlKTFP72Gh0CAH5+Wk/Z8Wp6Cg4Li8PXCtxZglnXH/voAIYLiGRq0L1ARu6f cUjwzsa4TI3WpKzik4BQe3uZt9dxhpQr4+CQWTL/U6hQBG17raihcshgOhQNiSdZ J+RyKy4HV+4NJfR577vqKQkdWwpEwkBS3nFbOVIU/NrX4wBkYn1TzeYEOY9Lsnx/ tuPkUqLUc+dDdxyq0huq1z82fYUtkg6nQHzlUn4LtcN+dmPJrQBNrfEz9XPFVi0G 0yjzhX/ZxzoxHPt3AGG66Q8pQqEXVQ== =Hp4a -----END PGP SIGNATURE----- --Sig_/BwM+ncN0lx02Kd/J5osWJMM--