From: Timothy Sample <samplet@ngyro.com>
To: divoplade <d@divoplade.fr>
Cc: help-guix@gnu.org
Subject: Re: How do I build a derivation with guix build?
Date: Sat, 05 Sep 2020 22:40:56 -0400 [thread overview]
Message-ID: <877dt7aapz.fsf@ngyro.com> (raw)
In-Reply-To: <908fa63077ee6cfe3174596099da22699d432e77.camel@divoplade.fr> (divoplade's message of "Sat, 05 Sep 2020 22:15:57 +0200")
Hi divoplade,
As I understand it, ‘gexp->derivation’ returns a value in the store
monad. I’m not sure why ‘guix build’ doesn’t know how to use it
directly, but you can get at the derivation by wrapping it with
‘run-with-store’:
(run-with-store (open-connection)
(gexp->derivation "the-thing" build-exp))
Don’t forget to use the ‘(guix store)’ module for this.
But! There’s a better way!! :)
You can use the “declarative interface”. Just replace
‘gexp->derivation’ with ‘computed-file’:
(computed-file "the-thing" build-exp)
Now there’s no need for ‘(guix store)’.
HTH!
-- Tim
divoplade <d@divoplade.fr> writes:
> Hello,
>
> I am still learning how to use gexps, and I thought that running this
> would work:
>
> guix build -f example.scm
>
> with example.scm containing:
>
> (use-modules (gnu packages base))
> (use-modules (guix gexp))
>
> (define build-exp
> #~(begin
> (mkdir #$output)
> (chdir #$output)
> (symlink (string-append #$coreutils "/bin/ls")
> "list-files")))
>
> (gexp->derivation "the-thing" build-exp)
>
> This is a copy of what's on the manual for explaining G-expressions.
>
> The guix build -f command should, according to the --help output:
> "build the package or derivation that the code within FILE evaluates
> to"
>
> However, I get an exception, "Wrong number of arguments to #<procedure
> 7f775f854f00 at guix/gexp.scm:1064:2 (state)>", after a backtrace that
> does not even contains example.scm.
>
> What is going on? How do you build the derivation?
>
> Best regards,
>
> divoplade
next prev parent reply other threads:[~2020-09-06 2:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-05 20:15 How do I build a derivation with guix build? divoplade
2020-09-06 2:40 ` Timothy Sample [this message]
2020-09-06 9:02 ` divoplade
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
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877dt7aapz.fsf@ngyro.com \
--to=samplet@ngyro.com \
--cc=d@divoplade.fr \
--cc=help-guix@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.
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).