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 YNfCN51ktmFIJAAAgWs5BA (envelope-from ) for ; Sun, 12 Dec 2021 22:07:41 +0100 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 qhyDM51ktmFBWgAA1q6Kng (envelope-from ) for ; Sun, 12 Dec 2021 21:07:41 +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 A0AC9A455 for ; Sun, 12 Dec 2021 22:07:41 +0100 (CET) Received: from localhost ([::1]:47530 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwW4K-0007ia-Na for larch@yhetil.org; Sun, 12 Dec 2021 16:07:40 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52524) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwW3c-0007gg-7X for guix-devel@gnu.org; Sun, 12 Dec 2021 16:06:57 -0500 Received: from sv-2s11.infcs.de ([194.95.66.48]:51440 helo=ux-2s-mailproxy.inf.h-brs.de) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwW3X-0003QA-Vi for guix-devel@gnu.org; Sun, 12 Dec 2021 16:06:54 -0500 Received: from gyps.h-brs.de (p5797302f.dip0.t-ipconnect.de [87.151.48.47]) (authenticated bits=0) by ux-2s-mailproxy.inf.h-brs.de (8.15.2/8.15.2/Debian-8ska0) with ESMTPSA id 1BCL6lE9002101 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 12 Dec 2021 22:06:47 +0100 References: <878rwqf1s4.fsf@h-brs.de> <20211212191711.43e4b7d2@scratchpost.org> User-agent: mu4e 1.7.4; emacs 27.2 From: gyps@member.fsf.org To: Danny Milosavljevic , Tobias Geerinckx-Rice Subject: Re: How to handle package udev rules? Date: Sun, 12 Dec 2021 21:58:14 +0100 In-reply-to: <20211212191711.43e4b7d2@scratchpost.org> Message-ID: <87sfux353z.fsf@h-brs.de> MIME-Version: 1.0 Content-Type: text/plain X-Auth: by SMTP AUTH @ ux-2s11 X-MIMEDefang-Info-ge: Gescannt in Inf@FH-BRS, Regeln s. MiniFAQ E-Mail/Mailscanner X-Scanned-By: MIMEDefang @ FB02 @ H-BRS Received-SPF: pass client-ip=194.95.66.48; envelope-from=gyps@member.fsf.org; helo=ux-2s-mailproxy.inf.h-brs.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-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=1639343261; 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=CrrrxP0kfDAqd5rdnu/OynQ70f6hH0E8nZHCzKIs99A=; b=TtBDctqUSsCc6vTJwBBHPtgEWhiZrw18WL0bQ/14EvKW8GVLEFsXKNGCws9bHrh286MpPF HUuab/b7/ov30DOoDmfE/F2/LWPPQAgQUsUqYxuUVuQjvnlcdPqrTsyTSky78yIM1vGeBe 7o99TGw6SZL1/q8tHAYJKhcc25CFh+oiR6OssjGLPHOVYFs0Wr43O6yeRPIhcmiFf2xPlG H7El/jAJkIyn5VBAgNcjkI+odOAOQ8HkOnt+5Fgw6mF6N+y/E3UY6CmsscGJs1SEP0+q0Q T85JMf8N4zKHW2eecmwDV6QlTxlusYah4ZSvUKRBs1ZTU/IknNN5G0WifOvYog== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1639343261; a=rsa-sha256; cv=none; b=MROxFzAvTosy7U1nkHkujwuxECnQ6h5ORMsGWrBD8dCzSpDvffgijAWWSn7XPMK7oXIUvO GJPtUCHy6OqyGJxHg9O7zMFSdu1T3B8uxfKQHPf490lz5eu91XT9D3MLcZ4EzkrArBszTL WghcXqmeEm2Fkahtqu+cXZqhVYy32sreikN9rWbLN9PnjGVcqSDH/dcjNO4kfCByayxfip Bs22VuRV1JcIlINzEpAKybluj+GUNEgcGpM19CXwNQqL4/ysYK14tIyGxsjsZcNJX5Khmn NHRLNszEYfLj2wLaQHoQIR3l7ePDEgRyUkTp/2rLg9pRuzEahl2B3sWzFCC9sA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=member.fsf.org (policy=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: -1.87 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=member.fsf.org (policy=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: A0AC9A455 X-Spam-Score: -1.87 X-Migadu-Scanner: scn1.migadu.com X-TUID: qnWfAL2FNUjT Dear Danny, dear Tobias, thanks for the hints which immediately solved my issue. It now compiles and everyting is fine but one thing. If I change my operating-system config to inlcude udev-rules from package "projecteur" everything works fine - at least if I do it as a regular user. As soon as I sudo the guix system reconfigure command the package is known but it's code is not. Error message is: > $ sudo guix system reconfigure ~/etc/config.scm > ice-9/boot-9.scm:3329:6: In procedure resolve-interface: > no code for module (projecteur) Could it be the case that sudo'ed the variable GUIX_PACKAGE_PATH is not known or not interpreted correctly? Does the package need to reside somewhere else than in GUIX_PACKAGE_PATH? Cheers, Alex On Sun, Dec 12 2021, 19:17:26, Danny Milosavljevic wrote: > [[PGP Signed Part:Undecided]] > 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 mechanism, > 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 distribution? > >> 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/99-my-ledger-nano.rules") > (lambda (port) > (format port > "SUBSYSTEM==\"usb\", ATTRS{idVendor}==\"2c97\", MODE=\"0600\", OWNER=\"dannym\", TAG+=\"uaccess\", TAG+=\"udev-acl\" > KERNEL==\"hidraw*\", ATTRS{idVendor}==\"2c97\", MODE=\"0600\", OWNER=\"dannym\", SYMLINK+=\"ledger_%n\", TAG+=\"uaccess\", TAG+=\"udev-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=$output//lib/udev/rules.d > > like this (in your package definition): > > (package > ... > (arguments > '(#:configure-flags (list (string-append "-DCMAKE_INSTALL_UDEVRULESDIR=" > (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 > > [[End of PGP Signed Part]]