all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: zimoun <zimon.toutoune@gmail.com>
To: Guix Devel <guix-devel@gnu.org>
Cc: "Ludovic Courtès" <ludo@gnu.org>
Subject: Help with G-expression
Date: Thu, 01 Dec 2022 18:34:32 +0100	[thread overview]
Message-ID: <86359zm3iv.fsf@gmail.com> (raw)

Hi,

Trying to make a Guix script for extracting BigBlueButton videos – the
ones from Café Guix for instance – I am very puzzled by G-expression.

Well, I am trying to adapt this one [1].  But I am failing…

The manual has this example [1],

--8<---------------cut here---------------start------------->8---
(with-imported-modules '((guix build utils))  ;import it
  (computed-file "empty-tree"
                 #~(begin
                     ;; Put it in scope.
                     (use-modules (guix build utils))

                     ;; Happily use its 'mkdir-p' procedure.
                     (mkdir-p (string-append #$output "/a/b/c")))))
--8<---------------cut here---------------end--------------->8---

Which I turn into a function, and from “guix repl”

--8<---------------cut here---------------start------------->8---
scheme@(guix-user)> (define (work)
  (with-imported-modules '((guix build utils))  ;import it
    (computed-file "empty-tree"
                   #~(begin
                       ;; Put it in scope.
                       (use-modules (guix build utils))

                       ;; Happily use its 'mkdir-p' procedure.
                       (mkdir-p (string-append #$output "/a/b/c"))))))

scheme@(guix-user)> ,build (work)
$1 = "/gnu/store/d8psk7dsczqj65sc8bqigpi6ffhd0wvn-empty-tree"
--8<---------------cut here---------------end--------------->8---

where “tree /gnu/store/d8psk7dsczqj65sc8bqigpi6ffhd0wvn-empty-tree” shows the tree a/b/c.  So far, so
good.

If instead, I just add the module (guix profiles), then it fails.

--8<---------------cut here---------------start------------->8---
scheme@(guix-user)> (define (fail)
  (with-imported-modules '((guix build utils)
                           (guix profiles))  ;import it
    (computed-file "empty-tree"
                   #~(begin
                       ;; Put it in scope.
                       (use-modules (guix build utils))

                       ;; Happily use its 'mkdir-p' procedure.
                       (mkdir-p (string-append #$output "/a/b/c"))))))
scheme@(guix-user)> ,build (fail)
substitute: updating substitutes from 'https://ci.guix.gnu.org'... 100.0%
substitute: updating substitutes from 'https://bordeaux.guix.gnu.org'... 100.0%
substitute: updating substitutes from 'https://ci.guix.gnu.org'... 100.0%
substitute: updating substitutes from 'https://bordeaux.guix.gnu.org'... 100.0%
building /gnu/store/g1jbxhhz4b7zcyixhy4vw13brn2fncia-module-import-compiled.drv...
 50% [####################################                                     ]builder for `/gnu/store/g1jbxhhz4b7zcyixhy4vw13brn2fncia-module-import-compiled.drv' failed with exit code 1
build of /gnu/store/g1jbxhhz4b7zcyixhy4vw13brn2fncia-module-import-compiled.drv failed
View build log at '/var/log/guix/drvs/g1/jbxhhz4b7zcyixhy4vw13brn2fncia-module-import-compiled.drv.gz'.
cannot build derivation `/gnu/store/ln5yb7lvdknr3azc5zh2m3239adgmsjj-empty-tree.drv': 1 dependencies couldn't be built
While executing meta-command:
ERROR:
  1. &store-protocol-error:
      message: "build of `/gnu/store/ln5yb7lvdknr3azc5zh2m3239adgmsjj-empty-tree.drv' failed"
      status: 100
--8<---------------cut here---------------end--------------->8---

Well, the message is not really helping. :-)

Then, because I am not sure to fully understand the difference, let add
’source-module-closure’.

--8<---------------cut here---------------start------------->8---
scheme@(guix-user)> ,use(guix modules)
scheme@(guix-user)> (define (fail-again)
  (with-imported-modules (source-module-closure
                          '((guix build utils)
                            (guix profiles)))  ;import it
    (computed-file "empty-tree"
                   #~(begin
                       ;; Put it in scope.
                       (use-modules (guix build utils))

                       ;; Happily use its 'mkdir-p' procedure.
                       (mkdir-p (string-append #$output "/a/b/c"))))))
scheme@(guix-user)> ,build (fail-again)
While executing meta-command:
Throw to key `match-error' with args `("match" "no matching pattern" (#:declarative? #f #:export (%guix-package-name %guix-version %guix-bug-report-address %guix-home-page-url %channel-metadata %system %store-directory %state-directory %store-database-directory %config-directory %gzip %bzip2 %xz)))'.
--8<---------------cut here---------------end--------------->8---

Ah, another message.  Not helping either. :-)


What do I miss or am doing wrong?


1: <https://gitlab.inria.fr/guix-hpc/website/-/blob/6977da4618814c790e767618da5cf9ec2cab0742/doc/atelier-reproductibilit%C3%A9/render-videos.scm>
2: https://guix.gnu.org/manual/devel/en/guix.html#Build-Utilities

Cheers,
simon


             reply	other threads:[~2022-12-01 18:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-01 17:34 zimoun [this message]
2022-12-01 18:21 ` Help with G-expression (
2022-12-01 18:52   ` zimoun
2022-12-02  9:09     ` Ludovic Courtès
2022-12-02 13:19       ` zimoun
2022-12-02 21:30         ` Ludovic Courtès
2022-12-02 22:00           ` zimoun
2022-12-03 17:43             ` Ludovic Courtès
2022-12-04 11:11               ` zimoun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86359zm3iv.fsf@gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=guix-devel@gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.