Hi!
Thanks a lot Tomas
On 06/09/2025 00:14, Tomas Volf wrote:
Hi!
Alexis Simon <[email protected]> writes:
Hi Guix,
I am wondering how I could easily make a script to build all packages that are
defined in my local channel.
This would be an easy way to make a local "CI" to test changes without setting
up a full fledged CI server.
I don't know where to start, any pointers or examples of small scripts doing
that?
I had no idea how to do this, but it sounds interesting, so I took some
time to experiment. Under the condition that all packages in your
channel are under some directory path (which would typically be the
case), it seems you can use something like this:
guix build -L /home/alexis/my/channel -e '
(use-modules (gnu packages) (guix))
(fold-packages (lambda (pkg lst)
(if (string-prefix? "/home/alexis/my/channel"
(location-file (package-location pkg)))
(cons pkg lst)
lst))
(quote ()))'
This looks promising but I couldn't make this command work.
I get a `guix build: warning: no arguments specified, nothing to do`
This is probably a quoting problem on my end, but I've tried several
options and both fish and bash without luck.
On the other end, I've found that section 9.1 of the manual has a simple
command line example that does pretty much what I want.
I think modifying it to
guix build -L . --quiet --keep-going \
$(guix package -A | grep "my/channel" | awk '{ print $1 "@" $2 }')
is enough for my purposes.
Alexis
This seems to find all packages under some directory and then build
them.
Two key pieces of information are that just importing (gnu packages)
causes a scan of all .scm files in load path for defined packages, and
after that fold-packages allows you to fold over the set of all packages
known to Guix.
Hope this helps,
Tomas