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 <dan...@scratchpost.org> wrote: > [[PGP Signed Part:Undecided]] > Hello Alexander, > > On Sun, 12 Dec 2021 13:12:50 +0100 > Alexander Asteroth <alexander.aster...@h-brs.de> 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]]