* How to use guix-for-channels together with -L without errors?
@ 2024-08-14 22:24 Tomas Volf
2024-08-15 17:14 ` Nils Landt
0 siblings, 1 reply; 4+ messages in thread
From: Tomas Volf @ 2024-08-14 22:24 UTC (permalink / raw)
To: help-guix
[-- Attachment #1: Type: text/plain, Size: 1070 bytes --]
Hi,
I decided to start using guix-for-channels and run into weird issue.
Reproduction is easy:
1. Make a new directory.
2. Make an empty file with .scm extension, for example:
$ touch foo.scm
3. Try to build guix-for-channels in that directory with `-L .':
$ guix build -L . -e '((@ (gnu packages package-management) guix-for-channels) (@ (guix channels) %default-channels))'
4. Observe an error in the output:
Updating channel 'guix' from Git repository at 'https://git.savannah.gnu.org/git/guix.git'...
no code for module (foo)
Now, what I do not understand is why this error:
no code for module (foo)
is there. I am building guix from %default-channels, why is it even loading
files in the local directory? And how do I make it stop? In this case, I could
just drop `-L .', but in real code I need the argument to load modules required
for the system.
Any comments and/or ideas?
Thanks and have a nice day,
Tomas Volf
--
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] 4+ messages in thread
* Re: How to use guix-for-channels together with -L without errors?
2024-08-14 22:24 How to use guix-for-channels together with -L without errors? Tomas Volf
@ 2024-08-15 17:14 ` Nils Landt
2024-08-15 19:46 ` Tomas Volf
0 siblings, 1 reply; 4+ messages in thread
From: Nils Landt @ 2024-08-15 17:14 UTC (permalink / raw)
To: Tomas Volf, help-guix
> Tomas Volf <~@wolfsden.cz> hat am 15.08.2024 00:24 CEST geschrieben:
>
> Now, what I do not understand is why this error:
>
> no code for module (foo)
>
> is there. I am building guix from %default-channels, why is it even loading
> files in the local directory? And how do I make it stop? In this case, I could
> just drop `-L .', but in real code I need the argument to load modules required
> for the system.
When that happened to me, it took me forever to find out, so I'm happy to save you some pain:
The -L adds to the *package* module search path. Guix loads all the scm files there to get the package definitions, I'm guessing so there doesn't need to be empty modules with a huge "requires" list of every package-containing module.
So I put my package definitions in a subdirectory of the channels directory, add that subdirectory to GUIX_PACKAGE_PATH, and add the channel root directory to GUILE_LOAD_PATH.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to use guix-for-channels together with -L without errors?
2024-08-15 17:14 ` Nils Landt
@ 2024-08-15 19:46 ` Tomas Volf
2024-08-16 4:40 ` Nils Landt
0 siblings, 1 reply; 4+ messages in thread
From: Tomas Volf @ 2024-08-15 19:46 UTC (permalink / raw)
To: Nils Landt; +Cc: help-guix
[-- Attachment #1: Type: text/plain, Size: 2825 bytes --]
On 2024-08-15 19:14:52 +0200, Nils Landt wrote:
> > Tomas Volf <~@wolfsden.cz> hat am 15.08.2024 00:24 CEST geschrieben:
> >
> > Now, what I do not understand is why this error:
> >
> > no code for module (foo)
> >
> > is there. I am building guix from %default-channels, why is it even loading
> > files in the local directory? And how do I make it stop? In this case, I could
> > just drop `-L .', but in real code I need the argument to load modules required
> > for the system.
>
> When that happened to me, it took me forever to find out, so I'm happy to save
> you some pain: The -L adds to the *package* module search path. Guix loads all
> the scm files there to get the package definitions, I'm guessing so there
> doesn't need to be empty modules with a huge "requires" list of every
> package-containing module.
>
> So I put my package definitions in a subdirectory of the channels directory,
> add that subdirectory to GUIX_PACKAGE_PATH, and add the channel root directory
> to GUILE_LOAD_PATH.
Yes! That is it, when I use GUILE_LOAD_PATH instead of -L the errors go away.
Thank you so much. You have saved me so much time. ^_^
Now I have a different problem however. Given a channel list with commits,
hence resolving to the same code every time, it still gets pulled every time,
and Guix derivation computed every time. Illustrated here:
/tmp/repro $ cat x.scm
(use-modules (guix channels)
(gnu packages package-management))
(guix-for-channels (list (channel
(name 'guix)
(url "https://git.wolfsden.cz/.git/guix")
(commit
"b03eddc326ee4eb26b25743faee2080de6aded7e")
(introduction
(make-channel-introduction
"028e445a2028068e3c83996daa281057f19141a0"
(openpgp-fingerprint
"B783 49B3 8C14 7D36 2988 68A4 2FBF EE7D B67F C1A9"))))))
/tmp/repro $ guix build -f x.scm
Updating channel 'guix' from Git repository at 'https://git.wolfsden.cz/.git/guix'...
Computing Guix derivation for 'x86_64-linux'... |
/gnu/store/9i597ckynirxy4w5iv2wbmy288vc7gf0-profile
/tmp/repro $ guix build -f x.scm
Updating channel 'guix' from Git repository at 'https://git.wolfsden.cz/.git/guix'...
Computing Guix derivation for 'x86_64-linux'... |
/gnu/store/9i597ckynirxy4w5iv2wbmy288vc7gf0-profile
This does not seem necessary (it uses commit, so it does not change) and makes
re-deploys *much* slower. Would you happen to have magical trick for this as
well?
Tomas
--
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] 4+ messages in thread
* Re: How to use guix-for-channels together with -L without errors?
2024-08-15 19:46 ` Tomas Volf
@ 2024-08-16 4:40 ` Nils Landt
0 siblings, 0 replies; 4+ messages in thread
From: Nils Landt @ 2024-08-16 4:40 UTC (permalink / raw)
To: Tomas Volf; +Cc: help-guix
> Tomas Volf <~@wolfsden.cz> hat am 15.08.2024 21:46 CEST geschrieben:
>
> Now I have a different problem however. Given a channel list with commits,
> hence resolving to the same code every time, it still gets pulled every time,
> and Guix derivation computed every time. Illustrated here:
>
> /tmp/repro $ cat x.scm
> (use-modules (guix channels)
> (gnu packages package-management))
>
> (guix-for-channels (list (channel
> (name 'guix)
> (url "https://git.wolfsden.cz/.git/guix")
> (commit
> "b03eddc326ee4eb26b25743faee2080de6aded7e")
> (introduction
> (make-channel-introduction
> "028e445a2028068e3c83996daa281057f19141a0"
> (openpgp-fingerprint
> "B783 49B3 8C14 7D36 2988 68A4 2FBF EE7D B67F C1A9"))))))
> /tmp/repro $ guix build -f x.scm
> Updating channel 'guix' from Git repository at 'https://git.wolfsden.cz/.git/guix'...
> Computing Guix derivation for 'x86_64-linux'... |
> /gnu/store/9i597ckynirxy4w5iv2wbmy288vc7gf0-profile
> /tmp/repro $ guix build -f x.scm
> Updating channel 'guix' from Git repository at 'https://git.wolfsden.cz/.git/guix'...
> Computing Guix derivation for 'x86_64-linux'... |
> /gnu/store/9i597ckynirxy4w5iv2wbmy288vc7gf0-profile
>
> This does not seem necessary (it uses commit, so it does not change) and makes
> re-deploys *much* slower. Would you happen to have magical trick for this as
> well?
Sorry to disappoint, I don't use Guix system, only Guix home, so no idea :(
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-08-16 4:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-14 22:24 How to use guix-for-channels together with -L without errors? Tomas Volf
2024-08-15 17:14 ` Nils Landt
2024-08-15 19:46 ` Tomas Volf
2024-08-16 4:40 ` Nils Landt
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).