all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* guix system reconfigure: Wrong type argument in position 1 (expecting struct)
@ 2019-06-18 14:53 Giovanni Biscuolo
  2019-06-18 16:19 ` Julien Lepiller
  2019-06-18 16:36 ` Ricardo Wurmus
  0 siblings, 2 replies; 5+ messages in thread
From: Giovanni Biscuolo @ 2019-06-18 14:53 UTC (permalink / raw)
  To: help-guix

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

Hello Guix,

I'm trying to reconfigure but I get this error:

--8<---------------cut here---------------start------------->8---

~$ sudo -i guix system reconfigure /etc/config.scm 
Backtrace:
          14 (primitive-load "/root/.config/guix/current/bin/guix")
In guix/ui.scm:
  1620:12 13 (run-guix-command _ . _)
In ice-9/boot-9.scm:
    829:9 12 (catch _ _ #<procedure 7f43d8f15c80 at guix/ui.scm:587…> …)
    829:9 11 (catch _ _ #<procedure 7f43d8f15c98 at guix/ui.scm:710…> …)
In guix/scripts/system.scm:
   1325:8 10 (_)
In guix/status.scm:
    768:4  9 (call-with-status-report _ _)
In guix/scripts/system.scm:
   1181:4  8 (process-action _ _ _)
In guix/store.scm:
   623:10  7 (call-with-store _)
  1800:24  6 (run-with-store _ _ #:guile-for-build _ #:system _ # _)
In guix/scripts/system.scm:
  1197:13  5 (_ _)
   890:18  4 (perform-action reconfigure #<<operating-system> kerne…> …)
In gnu/system.scm:
   865:19  3 (operating-system-derivation _)
In gnu/services.scm:
    738:6  2 (instantiate-missing-services _)
In srfi/srfi-1.scm:
   466:18  1 (fold #<procedure 7f43cde31d60 at gnu/services.scm:738…> …)
In gnu/services.scm:
   739:27  0 (_ (#<<service> type: #<service-type login 1105dc0>…> …) …)

gnu/services.scm:739:27: In procedure struct_vtable: Wrong type argument in position 1 (expecting struct): (#<<service> type: #<service-type login 1105dc0> value: #<<login-configuration> motd: #<<plain-file> name: "motd" content: "This is the GNU operating system, welcome!\n\n" references: ()> allow-empty-passwords?: #t>> #<<service> type: #<service-type virtual-terminal 1105eb0> value: #t> #<<service> type: #<service-type console-fonts 1105e10> value: (("tty1" . "LatGrkCyr-8x16") ("tty2" . "LatGrkCyr-8x16") ("tty3" . "LatGrkCyr-8x16") ("tty4" . "LatGrkCyr-8x16") ("tty5" . "LatGrkCyr-8x16") ("tty6" . "LatGrkCyr-8x16"))> #<<service> type: #<service-type agetty 1105d70> value: #<<agetty-configuration> agetty: #<package util-linux@2.32.1 gnu/packages/linux.scm:733 2653b00> tty: #f term: "vt100" baud-rate: #f auto-login: #f login-program: #<file-append #<package shadow@4.6 gnu/packages/admin.scm:439 27edbb0> "/bin/login"> login-pause?: #f eight-bits?: #f no-reset?: #f remote?: #f flow-control?: #f host: #f no-issue?: #f init-string: #f no-clear?: #f local-line: #f extract-baud?: #f skip-login?: #f no-newline?: #f login-options: #f chroot: #f hangup?: #f keep-baud?: #f timeout: #f detect-case?: #f wait-cr?: #f no-hints?: #f no-hostname?: #f long-hostname?: #f erase-characters: #f kill-characters: #f chdir: #f delay: #f nice: #f extra-options: ("-L")>> #<<service> type: #<service-type mingetty 1105d20> value: #<<mingetty-configuration> mingetty: #<package mingetty@1.08 gnu/packages/admin.scm:496 27edb00> tty: "tty1" auto-login: #f login-program: #f login-pause?: #f>> #<<service> type: #<service-type mingetty 1105d20> value: #<<mingetty-configuration> mingetty: #<package mingetty@1.08 gnu/packages/admin.scm:496 27edb00> tty: "tty2" auto-login: #f login-program: #f login-pause?: #f>> #<<service> type: #<service-type mingetty 1105d20> value: #<<mingetty-configuration> mingetty: #<package mingetty@1.08 gnu/packages/admin.scm:496 27edb00> tty: "tty3" auto-login: #f login-program: #f login-pause?: #f>> #<<service> type: #<service-type mingetty 1105d20> value: #<<mingetty-configuration> mingetty: #<package mingetty@1.08 gnu/packages/admin.scm:496 27edb00> tty: "tty4" auto-login: #f login-program: #f login-pause?: #f>> #<<service> type: #<service-type mingetty 1105d20> value: #<<mingetty-configuration> mingetty: #<package mingetty@1.08 gnu/packages/admin.scm:496 27edb00> tty: "tty5" auto-login: #f login-program: #f login-pause?: #f>> #<<service> type: #<service-type mingetty 1105d20> value: #<<mingetty-configuration> mingetty: #<package mingetty@1.08 gnu/packages/admin.scm:496 27edb00> tty: "tty6" auto-login: #f login-program: #f login-pause?: #f>> #<<service> type: #<service-type static-networking 1105a00> value: (#<<static-networking> interface: "lo" ip: "127.0.0.1" netmask: #f gateway: #f provision: (loopback) requirement: () name-servers: ()>)> #<<service> type: #<service-type syslog 1105c80> value: #<<syslog-configuration> syslogd: #<file-append #<package inetutils@1.9.4 gnu/packages/admin.scm:405 27edc60> "/libexec/syslogd"> config-file: #<<plain-file> name: "syslog.conf" content: "\n     # Log all error messages, authentication messages of\n     # level notice or higher and anything of level err or\n     # higher to the console.\n     # Don't log private authentication messages!\n     *.alert;auth.notice;authpriv.none       /dev/console\n\n     # Log anything (except mail) of level info or higher.\n     # Don't log private authentication messages!\n     *.info;mail.none;authpriv.none          /var/log/messages\n\n     # Like /var/log/messages, but also including \"debug\"-level logs.\n     *.debug;mail.none;authpriv.none         /var/log/debug\n\n     # Same, in a different place.\n     *.info;mail.none;authpriv.none          /dev/tty12\n\n     # The authpriv file has restricted access.\n     authpriv.*                              /var/log/secure\n\n     # Log all the mail messages in one place.\n     mail.*                                  /var/log/maillog\n" references: ()>>> #<<service> type: #<service-type urandom-seed 15e8e60> value: #f> #<<service> type: #<service-type guix 1105be0> value: #<<guix-configuration> guix: #<package guix@1.0.1-3.4a54ed7 gnu/packages/package-management.scm:116 1a179a0> build-group: "guixbuild" build-accounts: 10 authorize-key?: #t authorized-keys: (#<<local-file> file: "keys/guix/roquette.mug.biscuolo.net.pub" absolute: #<promise #<procedure 7f43d43bb600 at /etc/config.scm:9:8 ()>> name: "roquette.mug.biscuolo.net.pub" recursive?: #f select?: #<procedure true (file stat)>> #<<local-file> file: "keys/guix/renaissanceFIXME.mug.biscuolo.net.pub" absolute: #<promise #<procedure 7f43d43bb630 at /etc/config.scm:10:8 ()>> name: "renaissanceFIXME.mug.biscuolo.net.pub" recursive?: #f select?: #<procedure true (file stat)>>) use-substitutes?: #t substitute-urls: ("https://ci.guix.gnu.org") chroot-directories: () max-silent-time: 0 timeout: 0 log-compression: bzip2 extra-options: () log-file: "/var/log/guix-daemon.log" http-proxy: #f tmpdir: #f>> #<<service> type: #<service-type nscd 1105cd0> value: #<<nscd-configuration> log-file: "/var/log/nscd.log" debug-level: 0 caches: (#<<nscd-cache> database: hosts positive-time-to-live: 43200 negative-time-to-live: 20 suggested-size: 211 check-files?: #t persistent?: #t shared?: #t max-database-size: 33554432 auto-propagate?: #t> #<<nscd-cache> database: services positive-time-to-live: 86400 negative-time-to-live: 3600 suggested-size: 211 check-files?: #t persistent?: #t shared?: #t max-database-size: 33554432 auto-propagate?: #t>) name-services: () glibc: #<package glibc@2.28 gnu/packages/commencement.scm:681 1e398f0>>> #<<service> type: #<service-type udev 1105b40> value: #<<udev-configuration> udev: #<package eudev@3.2.8 gnu/packages/linux.scm:2268 265b000> rules: (#<package lvm2@2.02.177 gnu/packages/linux.scm:2336 2661e70> #<package fuse@2.9.8 gnu/packages/linux.scm:1825 265b8f0> #<package alsa-utils@1.1.9 gnu/packages/linux.scm:1200 2653210> #<package crda@3.18 gnu/packages/linux.scm:2472 2661c60>)>> #<<service> type: #<service-type special-files 15e85f0> value: (("/bin/sh" #<file-append #<package bash@4.4.23 gnu/packages/bash.scm:123 2711370> "/bin/sh">))>)
--8<---------------cut here---------------end--------------->8---

Since everytime I try to purposely add a syntax error or miss to add a
module guix correctly point that out, I doubt it depends on some error
in my config.scm... or am I wrong?

Anyway, this is my slightly obfuscated config.scm:

--8<---------------cut here---------------start------------->8---
; This is batondor

(use-modules (gnu))
(use-service-modules networking ssh mcron virtualization)
(use-package-modules linux)

(define %authorized-guix-keys
  ;; List of authorized 'guix archive' keys.
  (list (local-file "keys/guix/OMISSIS.pub")
        (local-file "keys/guix/OMISSIS.pub")))

(define gc-job
  ;; Run 'guix gc' at 3AM every day.
  #~(job '(next-hour '(3)) "guix gc -F 50G"))

(define btrfs-job
  ;; Run 'btrfs balance' every three days to make free space.
  #~(job (lambda (now)
           (next-day-from now (range 1 31 3)))
         (string-append #$btrfs-progs "/bin/btrfs balance "
                        "start -dusage=50 -musage=70 /")))

;; The actual machine

(operating-system
 (locale "en_US.utf8")
 (timezone "Europe/Rome")
 (keyboard-layout
  (keyboard-layout "it" "nodeadkeys"))
 (bootloader
  (bootloader-configuration
   (bootloader grub-efi-bootloader)
   (target "/boot/efi")
   (keyboard-layout keyboard-layout)))
 (file-systems
  (cons* (file-system
	  (mount-point "/")
	  (device
	   (uuid "26bd54ec-4e74-4b3a-96ff-58f2f34e4a1a"
		 'btrfs))
	  (type "btrfs"))
	 (file-system
	  (mount-point "/boot/efi")
	  (device (uuid "7A61-DB20" 'fat32))
	  (type "vfat"))
	 %base-file-systems))
 (host-name "batondor")
 (users (cons* (user-account
		(name "x")
		(comment "XXXXXXXXXXXXXXXXX")
		(group "users")
		(home-directory "/home/x")
		(supplementary-groups
		 '("wheel" "kvm" "netdev" "audio" "video")))
	       %base-user-accounts))
 (packages
  (append
   (list (specification->package "nss-certs"))
   %base-packages))

 (services
  (append
   (list (service openssh-service-type
		  (openssh-configuration
		   (port-number 22)
		   (authorized-keys
		    `(("x" ,(local-file "keys/ssh/x.pub"))))))

	 (service dhcp-client-service-type)

	 (service ntp-service-type)

	 (service qemu-binfmt-service-type
		  (qemu-binfmt-configuration
		   (platforms (lookup-qemu-platforms "arm" "aarch64"))
		   (guix-support? #t)))

	 (service mcron-service-type
		  (mcron-configuration
		   (jobs (list gc-job btrfs-job))))

	 (modify-services %base-services
			  (guix-service-type config =>
					     (guix-configuration
					      (inherit config)
					      (use-substitutes? #t)
					      (authorized-keys
					       %authorized-guix-keys))))))))
--8<---------------cut here---------------end--------------->8---

Am I missing something or did I found a bug?

Thanks! Gio'.

-- 
Giovanni Biscuolo

Xelera IT Infrastructures

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

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

* Re: guix system reconfigure: Wrong type argument in position 1 (expecting struct)
  2019-06-18 14:53 guix system reconfigure: Wrong type argument in position 1 (expecting struct) Giovanni Biscuolo
@ 2019-06-18 16:19 ` Julien Lepiller
  2019-06-19  6:02   ` Giovanni Biscuolo
  2019-06-18 16:36 ` Ricardo Wurmus
  1 sibling, 1 reply; 5+ messages in thread
From: Julien Lepiller @ 2019-06-18 16:19 UTC (permalink / raw)
  To: Giovanni Biscuolo; +Cc: help-guix

Le Tue, 18 Jun 2019 16:53:51 +0200,
Giovanni Biscuolo <g@xelera.eu> a écrit :

> Hello Guix,
> 
> I'm trying to reconfigure but I get this error:
> 
> Since everytime I try to purposely add a syntax error or miss to add a
> module guix correctly point that out, I doubt it depends on some error
> in my config.scm... or am I wrong?
> 
> Anyway, this is my slightly obfuscated config.scm:
> 
> --8<---------------cut here---------------start------------->8---
> ; This is batondor
> 
> (use-modules (gnu))
> (use-service-modules networking ssh mcron virtualization)
> (use-package-modules linux)
> 
> (define %authorized-guix-keys
>   ;; List of authorized 'guix archive' keys.
>   (list (local-file "keys/guix/OMISSIS.pub")
>         (local-file "keys/guix/OMISSIS.pub")))
> 
> (define gc-job
>   ;; Run 'guix gc' at 3AM every day.
>   #~(job '(next-hour '(3)) "guix gc -F 50G"))
> 
> (define btrfs-job
>   ;; Run 'btrfs balance' every three days to make free space.
>   #~(job (lambda (now)
>            (next-day-from now (range 1 31 3)))
>          (string-append #$btrfs-progs "/bin/btrfs balance "
>                         "start -dusage=50 -musage=70 /")))
> 
> ;; The actual machine
> 
> (operating-system
>  (locale "en_US.utf8")
>  (timezone "Europe/Rome")
>  (keyboard-layout
>   (keyboard-layout "it" "nodeadkeys"))
>  (bootloader
>   (bootloader-configuration
>    (bootloader grub-efi-bootloader)
>    (target "/boot/efi")
>    (keyboard-layout keyboard-layout)))
>  (file-systems
>   (cons* (file-system
> 	  (mount-point "/")
> 	  (device
> 	   (uuid "26bd54ec-4e74-4b3a-96ff-58f2f34e4a1a"
> 		 'btrfs))
> 	  (type "btrfs"))
> 	 (file-system
> 	  (mount-point "/boot/efi")
> 	  (device (uuid "7A61-DB20" 'fat32))
> 	  (type "vfat"))
> 	 %base-file-systems))
>  (host-name "batondor")
>  (users (cons* (user-account
> 		(name "x")
> 		(comment "XXXXXXXXXXXXXXXXX")
> 		(group "users")
> 		(home-directory "/home/x")
> 		(supplementary-groups
> 		 '("wheel" "kvm" "netdev" "audio" "video")))
> 	       %base-user-accounts))
>  (packages
>   (append
>    (list (specification->package "nss-certs"))
>    %base-packages))
> 
>  (services
>   (append
>    (list (service openssh-service-type
> 		  (openssh-configuration
> 		   (port-number 22)
> 		   (authorized-keys
> 		    `(("x" ,(local-file "keys/ssh/x.pub"))))))
> 
> 	 (service dhcp-client-service-type)
> 
> 	 (service ntp-service-type)
> 
> 	 (service qemu-binfmt-service-type
> 		  (qemu-binfmt-configuration
> 		   (platforms (lookup-qemu-platforms "arm" "aarch64"))
> 		   (guix-support? #t)))
> 
> 	 (service mcron-service-type
> 		  (mcron-configuration
> 		   (jobs (list gc-job btrfs-job))))
> 
> 	 (modify-services %base-services
> 			  (guix-service-type config =>
> 					     (guix-configuration
> 					      (inherit config)
> 					      (use-substitutes? #t)
> 					      (authorized-keys
> 					       %authorized-guix-keys))))))))
> --8<---------------cut here---------------end--------------->8---

The result of modify-services is a list, but reading your file, it
seems you add it to the end of the (list ...) thing, which is not going
to work: you're ending up with a list of lists. You can either put the
modify-services form outside of that list:

  (service mcron-service-type
 	  (mcron-configuration
-	   (jobs (list gc-job btrfs-job))))
+ 	   (jobs (list gc-job btrfs-job)))))

 (modify-services %base-services
		  (guix-service-type config =>
				     (guix-configuration
				      (inherit config)
				      (use-substitutes? #t)
				      (authorized-keys
-					%authorized-guix-keys))))))))
+					%authorized-guix-keys)))))))

or replace the (append (list ...)) with a (cons* ...):

  (services
-   (append
-    (list (service openssh-service-type
+   (cons* (service openssh-service-type

- 		%authorized-guix-keys))))))))
+		%authorized-guix-keys)))))))

> 
> Am I missing something or did I found a bug?
> 
> Thanks! Gio'.
> 

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

* Re: guix system reconfigure: Wrong type argument in position 1 (expecting struct)
  2019-06-18 14:53 guix system reconfigure: Wrong type argument in position 1 (expecting struct) Giovanni Biscuolo
  2019-06-18 16:19 ` Julien Lepiller
@ 2019-06-18 16:36 ` Ricardo Wurmus
  2019-06-19  6:22   ` Giovanni Biscuolo
  1 sibling, 1 reply; 5+ messages in thread
From: Ricardo Wurmus @ 2019-06-18 16:36 UTC (permalink / raw)
  To: Giovanni Biscuolo; +Cc: help-guix


Hi Giovanni,

the problem is with your “services” field:

 (services
  (append
   (list …

	 (modify-services %base-services
			  (guix-service-type config =>
					     (guix-configuration
					      (inherit config)
					      (use-substitutes? #t)
					      (authorized-keys
					       %authorized-guix-keys)))))))

Note the indentation: modify-services returns a list and in your config
that’s inside of “list”.  “append” here only has one argument: a list
that contains a list of services (among others).

Pull out the modify-services expression, so that it becomes the second
argument to “append”.

-- 
Ricardo

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

* Re: guix system reconfigure: Wrong type argument in position 1 (expecting struct)
  2019-06-18 16:19 ` Julien Lepiller
@ 2019-06-19  6:02   ` Giovanni Biscuolo
  0 siblings, 0 replies; 5+ messages in thread
From: Giovanni Biscuolo @ 2019-06-19  6:02 UTC (permalink / raw)
  To: Julien Lepiller; +Cc: help-guix

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

Hello Julien,

thank you for your check!

Julien Lepiller <julien@lepiller.eu> writes:

[...]

> The result of modify-services is a list, but reading your file, it
> seems you add it to the end of the (list ...) thing,

Ouch... now **I see**! ...and begin to understand the error message

> which is not going
> to work: you're ending up with a list of lists. You can either put the
> modify-services form outside of that list:

[...]

> or replace the (append (list ...)) with a (cons* ...):

I adopted the latter, it makes (services...) more readeable to me

[...]

Kudos. Gio' aka `Guix-Fu Panda`

-- 
Giovanni Biscuolo

Xelera IT Infrastructures

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

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

* Re: guix system reconfigure: Wrong type argument in position 1 (expecting struct)
  2019-06-18 16:36 ` Ricardo Wurmus
@ 2019-06-19  6:22   ` Giovanni Biscuolo
  0 siblings, 0 replies; 5+ messages in thread
From: Giovanni Biscuolo @ 2019-06-19  6:22 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: help-guix

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

Ricardo Wurmus <rekado@elephly.net> writes:

[...]

> Pull out the modify-services expression, so that it becomes the second
> argument to “append”.

Thank you Ricardo, I applied the cons* solution suggested by Julien 

...what an amazing community: two answers in a few hours, you make me
feel home :-D

Happy Guix! Gio'.

-- 
Giovanni Biscuolo

Xelera IT Infrastructures

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

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

end of thread, other threads:[~2019-06-19  6:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-18 14:53 guix system reconfigure: Wrong type argument in position 1 (expecting struct) Giovanni Biscuolo
2019-06-18 16:19 ` Julien Lepiller
2019-06-19  6:02   ` Giovanni Biscuolo
2019-06-18 16:36 ` Ricardo Wurmus
2019-06-19  6:22   ` Giovanni Biscuolo

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.