From: Ricardo Wurmus <rekado@elephly.net>
To: Philippe SWARTVAGHER <philippe.swartvagher@inria.fr>
Cc: help-guix@gnu.org
Subject: Re: Package variant defined in manifest not visible by Guix
Date: Mon, 16 Aug 2021 16:34:55 +0200 [thread overview]
Message-ID: <87eeath300.fsf@elephly.net> (raw)
In-Reply-To: <12b2c37e-7389-d46a-8938-51b3285fd97c@inria.fr>
Hi,
> I'm trying to use a manifest file to define a package variant
> which adds
> an option to the configure phase:
>
> ```
>
> (use-modules (inria storm))
>
> (define starpu-maxnodes1
> (package
> (inherit starpu)
> (arguments
> (substitute-keyword-arguments (package-arguments starpu)
> ((#:configure-flags flags
> '())
> `(cons
> "--enable-maxnodes=1"
> ,flags))))))
>
> ```
>
> When I'm trying to build this variant, guix can't find it:
>
> ```
>
> % guix build -c 2 -m starpu-maxnodes1.scm starpu-maxnodes1
> guix build: erreur : starpu-maxnodes1 : paquet inconnu
>
> ```
>
> I don't see what I'm doing wrong. Any idea ?
There seems to be a small misunderstanding. You defined a package
variant, but that’s not a manifest. A manifest describes the
complete contents of a profile; i.e. it’s a list of packages that
Guix should install.
Here are three different ways that should work for you:
1) Build a single package from a file.
Here we define the package variant in a file and make sure that
the file evaluates to the package value:
--8<---------------cut here---------------start------------->8---
(use-modules (inria storm))
(define starpu-maxnodes1
(package
(inherit starpu)
(arguments
(substitute-keyword-arguments (package-arguments starpu)
((#:configure-flags flags '())
`(cons "--enable-maxnodes=1"
,flags))))))
;; Make sure the file evaluates to the package value.
;; The definition alone has no specified return value.
starpu-maxnodes1
--8<---------------cut here---------------end--------------->8---
Now we can build the package specified in the file:
guix build --file=this-file.scm
2) Build a whole manifest from a file.
Here the file must evaluate to a manifest value, not just a single
package.
--8<---------------cut here---------------start------------->8---
(use-modules (inria storm))
(define starpu-maxnodes1
(package
(inherit starpu)
(arguments
(substitute-keyword-arguments (package-arguments starpu)
((#:configure-flags flags '())
`(cons "--enable-maxnodes=1"
,flags))))))
(packages->manifest (list starpu-maxnodes1))
--8<---------------cut here---------------end--------------->8---
Then build the profile from the manifest file:
guix build --manifest=this-file.scm
3) Create a module and use it however you want.
You can make the custom package available to any Guix command by
putting it into a Guile module and then informing Guix about the
module. This is a little more effort as you need more boilerplate
code to define the module (and the file name needs to match the
moule header, etc).
--8<---------------cut here---------------start------------->8---
(define-module (my packages storm)
#:use-module (gnu packages)
#:use-module (guix packages)
#:use-module (guix utils)
;; …
#:use-module (inria storm)
#:export (starpu-maxnodes1))
(define starpu-maxnodes1
(package
(inherit starpu)
(arguments
(substitute-keyword-arguments (package-arguments starpu)
((#:configure-flags flags '())
`(cons "--enable-maxnodes=1"
,flags))))))
--8<---------------cut here---------------end--------------->8---
Put this in a file “my/packages/storm.scm” and then set the
GUIX_PACKAGE_PATH environment variable to the directory containing
“my” (e.g. $HOME/code/guix/custom containing
$HOME/code/guix/custom/my/packages/storm.scm).
Note that you haven’t overridden the “name” field of the original
“starpu” package, so on the command line the package cannot be
distinguished (unless you use “-e '(@ (my packages storm)
starpu-maxnodes1)'”). Do this to also change the name on the
command line:
--8<---------------cut here---------------start------------->8---
(define starpu-maxnodes1
(package
(inherit starpu)
(name "starpu-maxnodes1")
(arguments
(substitute-keyword-arguments (package-arguments starpu)
((#:configure-flags flags '())
`(cons "--enable-maxnodes=1"
,flags))))))
--8<---------------cut here---------------end--------------->8---
Hope this helps!
--
Ricardo
next prev parent reply other threads:[~2021-08-16 14:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-16 8:08 Package variant defined in manifest not visible by Guix Philippe SWARTVAGHER
2021-08-16 12:04 ` Efraim Flashner
2021-08-16 14:34 ` Ricardo Wurmus [this message]
2021-08-17 7:17 ` zimoun
2021-08-18 8:57 ` Philippe SWARTVAGHER
2021-08-18 13:21 ` 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
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=87eeath300.fsf@elephly.net \
--to=rekado@elephly.net \
--cc=help-guix@gnu.org \
--cc=philippe.swartvagher@inria.fr \
/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).