* Module unavailable on build side
@ 2024-01-14 4:12 Felix Lechner via Development of GNU Guix and the GNU System distribution.
2024-01-14 12:55 ` Tomas Volf
0 siblings, 1 reply; 3+ messages in thread
From: Felix Lechner via Development of GNU Guix and the GNU System distribution. @ 2024-01-14 4:12 UTC (permalink / raw)
To: guix-devel
Hi,
How may I make code from a channel available inside 'modify-phases',
please?
I tried #:modules, but it says "no code for (x y z)." Thanks!
Kind regards
Felix
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Module unavailable on build side
2024-01-14 4:12 Module unavailable on build side Felix Lechner via Development of GNU Guix and the GNU System distribution.
@ 2024-01-14 12:55 ` Tomas Volf
2024-01-15 0:20 ` Attila Lendvai
0 siblings, 1 reply; 3+ messages in thread
From: Tomas Volf @ 2024-01-14 12:55 UTC (permalink / raw)
To: Felix Lechner; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 2298 bytes --]
Hi,
On 2024-01-13 20:12:38 -0800, Felix Lechner via Development of GNU Guix and the GNU System distribution. wrote:
> Hi,
>
> How may I make code from a channel available inside 'modify-phases',
> please?
>
> I tried #:modules, but it says "no code for (x y z)." Thanks!
Based on some quick experimentation `source-module-closure' seems to be the way.
Package definition importing a (nonguix licenses) module follows:
(use-modules (guix build-system gnu)
(guix gexp)
(guix modules)
(guix packages)
(nongnu packages linux))
(package
(name "test")
(version "1")
(source #f)
(build-system gnu-build-system)
(arguments
(list #:imported-modules
(source-module-closure `((nonguix licenses)
,@%gnu-build-system-modules)
#:select? (λ (m)
(or (guix-module-name? m)
(eq? (car m) 'nonguix))))
#:phases
#~(modify-phases %standard-phases
(add-before 'unpack 'foo
(λ _
(use-modules (nonguix licenses))
(error nonfree))))))
(home-page #f)
(synopsis #f)
(description #f)
(license #f))
This does "build" resulting in the expected error:
ice-9/boot-9.scm:1685:16: In procedure raise-exception:
#<procedure nonfree (uri #:optional comment)>
However it took me a while to find a module that actually works. Due to the web
of dependencies, it can get complex quickly and you would need to properly
manage the #:select? value. Just putting (const #t) in there sadly does not
work.
Not sure, maybe there is a better way. If there is, I hope someone will tell me
(us).
In the mean time, I hope this helps to some degree.
Have a nice day,
Tomas Volf
PS: My understanding it that #:modules is equivalent to (use-modules), that is
why I used #:imported-modules to add them into the build environment first.
--
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Module unavailable on build side
2024-01-14 12:55 ` Tomas Volf
@ 2024-01-15 0:20 ` Attila Lendvai
0 siblings, 0 replies; 3+ messages in thread
From: Attila Lendvai @ 2024-01-15 0:20 UTC (permalink / raw)
To: Tomas Volf; +Cc: Felix Lechner, guix-devel
this may help:
https://github.com/attila-lendvai/guix-crypto/blob/main/src/guix-crypto/service-utils.scm#L56
and you should grep for its use in that repo.
w-i-m ensures that the GEXP's that are instantiated in its dynamic extent will "capture" these modules as their dependencies, and i think it also inserts the appropriate use-modules forms at the head of the GEXP's.
but take this all with a grain of salt, because what i understand i decoded on my own from the guix codebase, and the names of these abstractions are rather misleading.
also, i'm using these in the service code that gets compiled for shepherd to be loaded. the environment surrounding the building of packages may behave differently.
HTH,
--
• attila lendvai
• PGP: 963F 5D5F 45C7 DFCD 0A39
--
“There is no difference between living and learning […] it is impossible and misleading and harmful to think of them as being separate.”
— John Holt (1923–1985)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-01-15 0:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-14 4:12 Module unavailable on build side Felix Lechner via Development of GNU Guix and the GNU System distribution.
2024-01-14 12:55 ` Tomas Volf
2024-01-15 0:20 ` Attila Lendvai
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.