[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: usage of guix import / adding a package

From: Julien Lepiller
Subject: Re: usage of guix import / adding a package
Date: Fri, 17 Jul 2020 00:27:06 +0200

Le Fri, 17 Jul 2020 00:10:36 +0200,
Zelphir Kaltstahl <> a écrit :

> Hello Guix Users!
> I read on
> "The guix import command is useful for people who would like to add a
> package to the distribution with as little work as possible—a
> legitimate demand. The command knows of a few repositories from which
> it can “import” package metadata. The result is a package definition,
> or a template thereof, in the format we know (see Defining Packages)."
> I've recently tried this, for example for MyPy:
> ~~~~
> guix import pypi -r mypy
> ~~~~
> This will result in Guile code printed to my terminal. However, I do
> not understand how to make use of that code. I do not understand how
> I can load it. For example I tried using the -l argument with guix
> environment:
> ~~~~
> guix import pypi -r mypy > additional_file.scm
> guix environment --pure --load=additional_file.scm --ad-hoc
> python@3.8.2 /home/user/dev/Python/additional_file.scm:2:2: error:
> package: unbound variable hint: Did you forget `(use-modules (guix
> packages))'? ~~~~
> So that seems to be the wrong way of trying to make use of it.
> Do I need to provide a patch to the project of the Guix package
> manager to add this to Guix packages in general and then be able to
> use it in my local setup?
> I do not find the info, how I can now use MyPy inside an environment
> or add it to the available packages on any of the following pages:
> -
> -
> While
> makes me think, that perhaps I need to submit it as patch to be able
> to use MyPy.
> If so, how would I test, whether guix import did its thing correctly?
> I could try running MyPy in an environment, but for that I would have
> to somehow make use of what guix import gives me, before submitting a
> patch.
> Also, if I need to submit a patch adding the guix import output
> somewhere, is there a guide on how to create such a patch for the Guix
> project?
> Regards,
> Zelphir

Hi zelphir,

You don't need to send a patch, although it would be very welcome. You
should read
where you can learn about package modules and how to import missing
modules that cause the issue you are having. Basically, you need a
header such as

(use-modules (gnu) (guix packages))

Then, you'll have to make sure your file returns something: guix import
-r will return you a code that defines one or more variables, but
nothing is returned. If you don't do anything, after adding the
required headers, you'll simply see an error about #<undefined>.

Put the name of the package you want to build in its own line at the
very end of the file, like:


this will ensure the value associated with that variable is returned
from the file, and you will be able to load the file with guix
environment -l or guix build -f.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]