unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* define udev-service-type fails with "did you forget to import.." error
@ 2020-09-27 21:23 Stefan Huchler
  2020-09-29 14:12 ` Ludovic Courtès
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Huchler @ 2020-09-27 21:23 UTC (permalink / raw)
  To: help-guix

When I try to redefine the udev-service like described in:
https://guix.gnu.org/manual/en/html_node/Service-Types-and-Services.html


(define udev-service-type
  (service-type (name 'udev)
                (extensions
                 (list (service-extension shepherd-root-service-type
                                          udev-shepherd-service)))
                (compose concatenate)       ;concatenate the list of rules
                (extend (lambda (config rules)
                          (match config
                            (($ <udev-configuration> udev initial-rules)
                             (udev-configuration
                              (udev eudev)   ;the udev package to use
                              (rules initial-rules))))))))

I get following error:
/etc/config.scm:128:0: error: udev-shepherd-service: unbound variable
hint: Did you forget `(use-modules (gnu services base))'?

Despite having:
(use-modules (gnu services base)...)

Any Idea what I do wrong?


btw I removed the append part of rules
otherwise it's copied from that docu example.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: define udev-service-type fails with "did you forget to import.." error
  2020-09-27 21:23 define udev-service-type fails with "did you forget to import.." error Stefan Huchler
@ 2020-09-29 14:12 ` Ludovic Courtès
  2020-09-29 16:23   ` Stefan Huchler
  2020-10-04 10:18   ` Stefan Huchler
  0 siblings, 2 replies; 10+ messages in thread
From: Ludovic Courtès @ 2020-09-29 14:12 UTC (permalink / raw)
  To: Stefan Huchler; +Cc: help-guix

Hi,

Stefan Huchler <stefan.huchler@mail.de> skribis:

> I get following error:
> /etc/config.scm:128:0: error: udev-shepherd-service: unbound variable
> hint: Did you forget `(use-modules (gnu services base))'?

Could you send /etc/config.scm so we can see the context?

Thanks,
Ludo’.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: define udev-service-type fails with "did you forget to import.." error
  2020-09-29 14:12 ` Ludovic Courtès
@ 2020-09-29 16:23   ` Stefan Huchler
  2020-10-04 10:29     ` Ricardo Wurmus
  2020-10-04 10:18   ` Stefan Huchler
  1 sibling, 1 reply; 10+ messages in thread
From: Stefan Huchler @ 2020-09-29 16:23 UTC (permalink / raw)
  To: help-guix

[-- Attachment #1: Type: text/plain, Size: 364 bytes --]

Ludovic Courtès <ludo@gnu.org> writes:

> Hi,
>
> Stefan Huchler <stefan.huchler@mail.de> skribis:
>
>> I get following error:
>> /etc/config.scm:128:0: error: udev-shepherd-service: unbound variable
>> hint: Did you forget `(use-modules (gnu services base))'?
>
> Could you send /etc/config.scm so we can see the context?
>
> Thanks,
> Ludo’.

Yes of course.


[-- Attachment #2: config.scm --]
[-- Type: application/octet-stream, Size: 2860 bytes --]

;; This is an operating system configuration generated
;; by the graphical installer.

;; Import nonfree linux module.
(use-modules (nongnu packages linux)
             (nongnu system linux-initrd)
	     (gnu services base)
	     (gnu system linux-initrd)
	     (gnu services shepherd)
	     (eudev)
	     (gnu)
	     ;; (ice-9 match)
	     ;; (srfi srfi-1)
	     )
(use-service-modules desktop networking ssh xorg base)

(define udev-service-type
  (service-type (name 'udev)
                (extensions
                 (list (service-extension shepherd-root-service-type
                                          udev-shepherd-service)))
                (compose concatenate)       ;concatenate the list of rules
                (extend (lambda (config rules)
                          (match config
                            (($ <udev-configuration> udev initial-rules)
                             (udev-configuration
                              (udev eudev)   ;the udev package to use
                              ;; (rules initial-rules)
			      )))))))

(operating-system
 (kernel linux)
 (initrd microcode-initrd)
 (firmware (cons* iwlwifi-firmware
		  %base-firmware))
 ;; (firmware (list linux-firmware))
 (locale "en_US.utf8")
 (timezone "Europe/Amsterdam")
 (keyboard-layout (keyboard-layout "us" "dvorak"))
 (host-name "neptun")
 (users (cons* (user-account
		(name "black")
		(comment "Black")
		(group "users")
		(home-directory "/home/black")
		(supplementary-groups
		 '("wheel" "netdev" "audio" "video")))
	       %base-user-accounts))
 (packages
  (append
   (list (specification->package "i3-wm")
	 (specification->package "i3status")
	 (specification->package "dmenu")
	 (specification->package "my-eudev")
	 (specification->package "st")
	 ;; (specification->package "kodi")
	 ;; (specification->package "eudev")
	 (specification->package "emacs")
	 (specification->package "wget")
	 (specification->package "git")
	 (specification->package "python2-pillow")
	 (specification->package "nss-certs"))
   %base-packages))
 (services
  (append
   (list
    (cons (udev-service-type)
                   %base-services)
    (service openssh-service-type
	     (openssh-configuration
	      (permit-root-login #t)))
    ;; (service special-files-service-type
    ;; 	  `(("/etc/udev/hwdb.d/90-X220-keyboard.hwdb"
    ;; 	     ,(file-append x220-hwdb "90-X220-keyboard.hwdb"))))
    (set-xorg-configuration
     (xorg-configuration
      (keyboard-layout keyboard-layout))))
   %desktop-services))
 (bootloader
  (bootloader-configuration
   (bootloader grub-bootloader)
   (target "/dev/sda")
   (keyboard-layout keyboard-layout)))
 (swap-devices (list "/dev/sda1"))
 (file-systems
  (cons* (file-system
	  (mount-point "/")
	  (device
	   (uuid "b11aa0fd-ebbe-4994-bfd5-8bf4c79bf6e7"
		 'ext4))
	  (type "ext4"))
	 %base-file-systems)))

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: define udev-service-type fails with "did you forget to import.." error
  2020-09-29 14:12 ` Ludovic Courtès
  2020-09-29 16:23   ` Stefan Huchler
@ 2020-10-04 10:18   ` Stefan Huchler
  1 sibling, 0 replies; 10+ messages in thread
From: Stefan Huchler @ 2020-10-04 10:18 UTC (permalink / raw)
  To: help-guix

Hello Ludo,
did you see my answer?

Ludovic Courtès <ludo@gnu.org> writes:

> Hi,
>
> Stefan Huchler <stefan.huchler@mail.de> skribis:
>
>> I get following error:
>> /etc/config.scm:128:0: error: udev-shepherd-service: unbound variable
>> hint: Did you forget `(use-modules (gnu services base))'?
>
> Could you send /etc/config.scm so we can see the context?
>
> Thanks,
> Ludo’.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: define udev-service-type fails with "did you forget to import.." error
  2020-09-29 16:23   ` Stefan Huchler
@ 2020-10-04 10:29     ` Ricardo Wurmus
  2020-10-04 14:18       ` Stefan Huchler
  0 siblings, 1 reply; 10+ messages in thread
From: Ricardo Wurmus @ 2020-10-04 10:29 UTC (permalink / raw)
  To: Stefan Huchler; +Cc: help-guix


Stefan Huchler <stefan.huchler@mail.de> writes:

> Ludovic Courtès <ludo@gnu.org> writes:
>
>> Hi,
>>
>> Stefan Huchler <stefan.huchler@mail.de> skribis:
>>
>>> I get following error:
>>> /etc/config.scm:128:0: error: udev-shepherd-service: unbound variable
>>> hint: Did you forget `(use-modules (gnu services base))'?
>>
>> Could you send /etc/config.scm so we can see the context?
>>
>> Thanks,
>> Ludo’.
>
> Yes of course.

That module does not export udev-shepherd-service AFAICT.

-- 
Ricardo


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: define udev-service-type fails with "did you forget to import.." error
  2020-10-04 10:29     ` Ricardo Wurmus
@ 2020-10-04 14:18       ` Stefan Huchler
  2020-10-04 15:00         ` Tobias Geerinckx-Rice
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Huchler @ 2020-10-04 14:18 UTC (permalink / raw)
  To: help-guix

And which does, and why does guix cli interface claim it would do that,
with it's hint? A bug?

Ricardo Wurmus <rekado@elephly.net> writes:

> Stefan Huchler <stefan.huchler@mail.de> writes:
>
>> Ludovic Courtès <ludo@gnu.org> writes:
>>
>>> Hi,
>>>
>>> Stefan Huchler <stefan.huchler@mail.de> skribis:
>>>
>>>> I get following error:
>>>> /etc/config.scm:128:0: error: udev-shepherd-service: unbound variable
>>>> hint: Did you forget `(use-modules (gnu services base))'?
>>>
>>> Could you send /etc/config.scm so we can see the context?
>>>
>>> Thanks,
>>> Ludo’.
>>
>> Yes of course.
>
> That module does not export udev-shepherd-service AFAICT.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: define udev-service-type fails with "did you forget to import.." error
  2020-10-04 14:18       ` Stefan Huchler
@ 2020-10-04 15:00         ` Tobias Geerinckx-Rice
  2020-10-04 20:06           ` Stefan Huchler
  2020-10-04 20:25           ` Stefan Huchler
  0 siblings, 2 replies; 10+ messages in thread
From: Tobias Geerinckx-Rice @ 2020-10-04 15:00 UTC (permalink / raw)
  To: Stefan Huchler; +Cc: help-guix

[-- Attachment #1: Type: text/plain, Size: 1079 bytes --]

Stefan,

Stefan Huchler 写道:
> When I try to redefine the udev-service like described in [0]
[...]
> I get following error: /etc/config.scm: [...]

That's not what [0] describes, is it?  It illustrates some service 
concepts, using real code as example.

It doesn't imply that the example code can or should be added to a 
system configuration.

>> That module does not export udev-shepherd-service AFAICT.
> And which does,

Nobody: (gnu services base) defines udev-shepherd-service but does 
not export it.  It's not intended to be API, nor do I think it 
needs to be.

You might be able to use (@@ (gnu services base) 
udev-shepherd-service), which forces the module to give up its 
secrets.  It's not good style, and it won't always work but often 
does.

> and why does guix cli interface claim it would do that,
> with it's hint?

Because it's naive.  See <http://issues.guix.gnu.org/43498> and - 
please! - beat me to a fix ;-)

Kind regards,

T G-R

[0]: 
https://guix.gnu.org/manual/en/html_node/Service-Types-and-Services.html

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 247 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: define udev-service-type fails with "did you forget to import.." error
  2020-10-04 15:00         ` Tobias Geerinckx-Rice
@ 2020-10-04 20:06           ` Stefan Huchler
  2020-10-04 20:25           ` Stefan Huchler
  1 sibling, 0 replies; 10+ messages in thread
From: Stefan Huchler @ 2020-10-04 20:06 UTC (permalink / raw)
  To: help-guix

Tobias Geerinckx-Rice <me@tobias.gr> writes:

> That's not what [0] describes, is it?  It illustrates some service
> concepts, using real code as example.

First maybe that is because of text messages and you don't see a face
but your messages sounds a bit passive agressive, but independent from
that I am happy to get a answer, so thanks.

> It doesn't imply that the example code can or should be added to a
> system configuration.

I thought that meaned to be example code to extend such code, but I
english is not my first language and I might read not everything
extremely carefully.

> Nobody: (gnu services base) defines udev-shepherd-service but does not
> export it.  It's not intended to be API, nor do I think it needs to
> be.

Yes and no, I reported 3 weeks ago:

http://issues.guix.gnu.org/issue/43390

So if there would be a direct way to access the hwdb capability of udev
service I would be happy to not use this hack, but for now I priotise
something running over something done the right way, I am good at elisp
but not so good with guile or with understanding the guix architecture,
I try to get a laptop in a usable shape so that I can maybe start being
more productive use the emacs module and well over time learn. I don't
want to become a guix / scheme expert just to get my keyboard working on
my laptop which is my second installation after my netbook on which I
will not code much for guix.

I am totally open to better solutions but if I have to write 10 messages
in 3 weeks I take what I can get, to get the system working.

> You might be able to use (@@ (gnu services base)
> udev-shepherd-service), which forces the module to give up its
> secrets.  It's not good style, and it won't always work but often
> does.

I will test that and report back, thanks for the info.

> Because it's naive.  See <http://issues.guix.gnu.org/43498> and - 
> please! - beat me to a fix ;-)

Maybe I will, just currently more into some elisp/emacs projects.

Regards

Stefan Huchler



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: define udev-service-type fails with "did you forget to import.." error
  2020-10-04 15:00         ` Tobias Geerinckx-Rice
  2020-10-04 20:06           ` Stefan Huchler
@ 2020-10-04 20:25           ` Stefan Huchler
  2020-10-04 20:55             ` Tobias Geerinckx-Rice
  1 sibling, 1 reply; 10+ messages in thread
From: Stefan Huchler @ 2020-10-04 20:25 UTC (permalink / raw)
  To: help-guix

Tobias Geerinckx-Rice <me@tobias.gr> writes:

> You might be able to use (@@ (gnu services base)
> udev-shepherd-service), which forces the module to give up its
> secrets.  It's not good style, and it won't always work but often
> does.

A the double @ was a typo? tried it inside of (use-modules) with 1 or 2
@ the error I get is when I set it in the file:

  source expression failed to match any pattern



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: define udev-service-type fails with "did you forget to import.." error
  2020-10-04 20:25           ` Stefan Huchler
@ 2020-10-04 20:55             ` Tobias Geerinckx-Rice
  0 siblings, 0 replies; 10+ messages in thread
From: Tobias Geerinckx-Rice @ 2020-10-04 20:55 UTC (permalink / raw)
  To: Stefan Huchler; +Cc: help-guix

[-- Attachment #1: Type: text/plain, Size: 1257 bytes --]

Stefan,

Stefan Huchler 写道:
> A the double @ was a typo?

No, it's a documented feature in the Guile manual:

   “You can also directly refer to bindings in a module by using 
   the ‘@’
   syntax.  For example, instead of using the ‘use-modules’ 
   statement from
   above and writing ‘unixy:pipe-open’ to refer to the ‘pipe-open’ 
   from the
   ‘(ice-9 popen)’, you could also write ‘(@ (ice-9 popen) 
   open-pipe)’.
   Thus an alternative to the complete ‘use-modules’ statement 
   would be

     (define unixy:pipe-open (@ (ice-9 popen) open-pipe))
     (define unixy:close-pipe (@ (ice-9 popen) close-pipe))

   There is also ‘@@’, which can be used like ‘@’, but does not 
   check
   whether the variable that is being accessed is actually 
   exported.  Thus,
   ‘@@’ can be thought of as the impolite version of ‘@’ and 
   should only be
   used as a last resort or for debugging, for example.

   Note that just as with a ‘use-modules’ statement, any module 
   that has
   not yet been loaded will be loaded when referenced by a ‘@’ or 
   ‘@@’
   form.” -- (guile)Using Guile Modules

I think I'm done here though.

Good luck,

T G-R

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 247 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-10-04 20:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-27 21:23 define udev-service-type fails with "did you forget to import.." error Stefan Huchler
2020-09-29 14:12 ` Ludovic Courtès
2020-09-29 16:23   ` Stefan Huchler
2020-10-04 10:29     ` Ricardo Wurmus
2020-10-04 14:18       ` Stefan Huchler
2020-10-04 15:00         ` Tobias Geerinckx-Rice
2020-10-04 20:06           ` Stefan Huchler
2020-10-04 20:25           ` Stefan Huchler
2020-10-04 20:55             ` Tobias Geerinckx-Rice
2020-10-04 10:18   ` Stefan Huchler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).