unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Julien Lepiller <julien@lepiller.eu>
To: Zelphir Kaltstahl <zelphirkaltstahl@posteo.de>
Cc: help-guix@gnu.org
Subject: Re: usage of guix import / adding a package
Date: Fri, 17 Jul 2020 00:27:06 +0200	[thread overview]
Message-ID: <20200717002706.6be8fcd6@tachikoma.lepiller.eu> (raw)
In-Reply-To: <85cf6cfd-5bc1-d04a-7fbb-28e012c40215@posteo.de>

Le Fri, 17 Jul 2020 00:10:36 +0200,
Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> a écrit :

> Hello Guix Users!
> 
> I read on
> https://guix.gnu.org/manual/en/html_node/Invoking-guix-import.html:
> 
> "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:
> 
> -
> https://guix.gnu.org/manual/en/html_node/Python-Modules.html#Python-Modules
> 
> - https://guix.gnu.org/manual/en/html_node/Invoking-guix-import.html
> 
> While https://guix.gnu.org/manual/en/html_node/Submitting-Patches.html
> 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
https://guix.gnu.org/manual/devel/en/html_node/Defining-Packages.html
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))
etc...

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:

python-mypy

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.

HTH!


  reply	other threads:[~2020-07-16 22:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-16 22:10 usage of guix import / adding a package Zelphir Kaltstahl
2020-07-16 22:27 ` Julien Lepiller [this message]
2020-10-12 17:43   ` Zelphir Kaltstahl
2020-10-13  6:25     ` Efraim Flashner
2020-10-13 19:44       ` Zelphir Kaltstahl

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=20200717002706.6be8fcd6@tachikoma.lepiller.eu \
    --to=julien@lepiller.eu \
    --cc=help-guix@gnu.org \
    --cc=zelphirkaltstahl@posteo.de \
    /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).