unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#64090: Cannot compute a file with a G-exp
@ 2023-06-16  1:17 Robby Zambito
  2023-06-17  7:51 ` paren--- via Bug reports for GNU Guix
  0 siblings, 1 reply; 4+ messages in thread
From: Robby Zambito @ 2023-06-16  1:17 UTC (permalink / raw)
  To: 64090

Hi,

I seem to be having two issues with writing a G-exp that computes a
file. The first issue I ran into is that source-module-closure returns
null no matter what modules I give it.

```
scheme@(guile-user)> (source-module-closure '((ice-9 popen) (ice-9 atomic) (ini) (json)))
$8 = ()
```

This seems to be a bug to me.

I found that I could get a partial list of dependencies using
source-module-dependencies, which seems to only include the direct
dependencies. So in my G-exp that I want to have depend on (ini), I used:

```
(with-imported-modules (source-module-dependencies '(ini)))
```

and then slowly worked on rebuilding over and over again, adding each
dependency as it was reported as missing.

Now that I have a seemingly correct (as far as the dependencies are
concerned) expression, I have run into another issue.

```
scheme@(guile-user)> ;; Assumes a file exists at wofi/style.css
scheme@(guile-user)> (define rz/terminal-emulator "foot")
scheme@(guile-user)> (import (guix gexp) (guix modules) (guix))
scheme@(guile-user)> ,build (computed-file "config" (with-imported-modules
      (append (source-module-dependencies '(ini))
	      '((ini)
		(scheme documentation)
		(smc core common)
		(smc context common)
		(smc context u8)
		(smc context char)
		(smc core config)
		(smc core log)
		(logging logger)
		(smc core state)
		(smc core transition)
		(smc context oop generic)
		(smc context oop port)
		(smc context oop char)
		(smc context oop u8)
		(smc fsm)
		(smc core set)))
    #~(begin
	(import (ini))
	(plain-file #$output
		    (with-output-to-string
		      (lambda ()
			(scm->ini
			 '((#f
			    ("stylesheet" . #$(local-file "wofi/style.css"))
			    ("xoffset" . 0)
			    ("yoffset" . 0)
			    ("hide_scroll" . "true")
			    ("show" . "drun")
			    ("width" . "600px")
			    ("lines" . 10)
			    ("line_wrap" . "word")
			    ("term" . #$rz/terminal-emulator)
			    ("allow_markup" . "true")
			    ("always_parse_args" . "true")
			    ("show_all" . "true")
			    ("print_command" . "true")
			    ("layer" . "overlay")
			    ("allow_images" . "true")
			    ("insensitivity" . "true")
			    ("prompt" . "Hey, you should type something!")
			    ("image_size" . 25)
			    ("display_generic" . "true")
			    ("key_expand" . "Tab"))))))))))
warning: importing modules (ice-9 receive) (ice-9 pretty-print) (ice-9 textual-ports) from the host
building /gnu/store/icvbvnjdiykc7lsraz16j1hsydfg77ld-module-import-compiled.drv...
 18% ▕████████████████████████████████████████▋                                                                                                                                                                                         ▏While executing meta-command:
User interrupt
```
At this point, if I do not interrupt the process, it will eat up all of
my systems memory and crash. Building my config with this provides some
more information:

```
The following derivations will be built:
  /gnu/store/a86dcbp4nckf40g7h7abw02viqn9aags-home.drv
  /gnu/store/1mr2bjmbjwqd0qg4zbhpiajbqz8ljxvm-files.drv
  /gnu/store/5rsbwalrkvd09gq554gc0dclc65vmyhj-wofi-config.drv
  /gnu/store/icvbvnjdiykc7lsraz16j1hsydfg77ld-module-import-compiled.drv
  /gnu/store/gn8jpf439qskxai3vyph8zv1p7ygsrsh-provenance.drv
building /gnu/store/gn8jpf439qskxai3vyph8zv1p7ygsrsh-provenance.drv...
successfully built /gnu/store/gn8jpf439qskxai3vyph8zv1p7ygsrsh-provenance.drv
building /gnu/store/icvbvnjdiykc7lsraz16j1hsydfg77ld-module-import-compiled.drv...
[ 1/50] Loading './ice-9/pretty-print.scm'...
[ 2/50] Loading './ice-9/receive.scm'...
[ 3/50] Loading './ice-9/textual-ports.scm'...
[ 4/50] Loading './ini/fsm-context-ini.scm'...
[ 5/50] Loading './ini/fsm-context.scm'...
[ 6/50] Loading './ini/fsm.scm'...
[ 7/50] Loading './ini.scm'...
[ 8/50] Loading './logging/logger.scm'...
[ 9/50] Loading './oop/goops.scm'...
interrupt
```

It hangs on importing `./oop/goops.scm`.

Regards,
Robby




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

* bug#64090: Cannot compute a file with a G-exp
  2023-06-16  1:17 bug#64090: Cannot compute a file with a G-exp Robby Zambito
@ 2023-06-17  7:51 ` paren--- via Bug reports for GNU Guix
  2023-06-17 14:05   ` Robby Zambito
  0 siblings, 1 reply; 4+ messages in thread
From: paren--- via Bug reports for GNU Guix @ 2023-06-17  7:51 UTC (permalink / raw)
  To: Robby Zambito; +Cc: 64090

Hi!

Robby Zambito <contact@robbyzambito.me> writes:
> scheme@(guile-user)> (source-module-closure '((ice-9 popen) (ice-9 atomic) (ini) (json)))
> $8 = ()

SOURCE-MODULE-CLOSURE only works for modules provided by Guix or Guix
channels ;) Modules included in Guile don't need it at all, and for
modules provided by third-party Guile libraries like guile-ini or
guile-json, you need to use WITH-EXTENSIONS:

  (use-modules (gnu packages guile-xyz))

  (with-extensions (list guile-ini guile-json) GEXP)

> I found that I could get a partial list of dependencies using
> source-module-dependencies, which seems to only include the direct
> dependencies. So in my G-exp that I want to have depend on (ini), I used:

No, it includes the entire dependency tree, but filters out any modules
that don't come from Guix or Guix channels.

> At this point, if I do not interrupt the process, it will eat up all of
> my systems memory and crash. Building my config with this provides some
> more information:

I suspect this will be fixed if you follow what I've said above.

  -- (




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

* bug#64090: Cannot compute a file with a G-exp
  2023-06-17  7:51 ` paren--- via Bug reports for GNU Guix
@ 2023-06-17 14:05   ` Robby Zambito
  2023-06-17 16:27     ` paren--- via Bug reports for GNU Guix
  0 siblings, 1 reply; 4+ messages in thread
From: Robby Zambito @ 2023-06-17 14:05 UTC (permalink / raw)
  To: (; +Cc: 64090


Hello,

"(" <paren@disroot.org> writes:

> SOURCE-MODULE-CLOSURE only works for modules provided by Guix or Guix
> channels ;) Modules included in Guile don't need it at all, and for
> modules provided by third-party Guile libraries like guile-ini or
> guile-json, you need to use WITH-EXTENSIONS:
>
>   (use-modules (gnu packages guile-xyz))
>
>   (with-extensions (list guile-ini guile-json) GEXP)

Well shucks, if only I read the next paragraph in the manual! Thank you
for pointing this out.

> No, it includes the entire dependency tree, but filters out any modules
> that don't come from Guix or Guix channels.

Strangely with-extensions doesn't seem to be including the whole
dependency tree for me. Should it? Maybe this is an issue with the
definition of the guile-ini package, but I also had to specify guile-smc
and guile-lib as extensions, even though I am not using either of those
directly.

Thank you for you help though :) I was able to get my G-Exp working as I
want

Robby




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

* bug#64090: Cannot compute a file with a G-exp
  2023-06-17 14:05   ` Robby Zambito
@ 2023-06-17 16:27     ` paren--- via Bug reports for GNU Guix
  0 siblings, 0 replies; 4+ messages in thread
From: paren--- via Bug reports for GNU Guix @ 2023-06-17 16:27 UTC (permalink / raw)
  To: Robby Zambito; +Cc: 64090

Robby Zambito <contact@robbyzambito.me> writes:
> Strangely with-extensions doesn't seem to be including the whole
> dependency tree for me. Should it?

No, I don't think it should. It *would* be possible to traverse the
package inputs and add all the GUILE-BUILD-SYSTEM-using packages, but
then you get the problem that not all Guile packages have their
dependencies specified in the INPUTS list (for some reason, IIRC, you
need the Guile dependencies to be in both INPUTS *and* NATIVE-INPUTS,
but some have them only in NATIVE-INPUTS). 

The problem there is that if you have a dependency that's only in
NATIVE-INPUTS, it's difficult to tell if it's actually used by the
application or by, say, a build script.

  -- (




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

end of thread, other threads:[~2023-06-17 16:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-16  1:17 bug#64090: Cannot compute a file with a G-exp Robby Zambito
2023-06-17  7:51 ` paren--- via Bug reports for GNU Guix
2023-06-17 14:05   ` Robby Zambito
2023-06-17 16:27     ` paren--- via Bug reports for GNU Guix

Code repositories for project(s) associated with this public inbox

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

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).