Subject: Cannot compute a file with a G-exp

From: Robby Zambito <[email-masked]>
Date: Thu, 15 Jun 2023 21:17:47 -0400

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