[Bio-packaging] testing out guix

Ricardo Wurmus ricardo.wurmus at mdc-berlin.de
Mon Jun 8 07:26:13 UTC 2015


> Seeing as package 
> files seem quite straightforward to write, I'm hoping it won't be too 
> much effort to write one for each piece of software that we publish.

Sounds great!

> but it is unclear what to do with the 'recipe' once created. Where do I 
> put it? What is a good name for a recipe file? How do I test/install it? 
> It would be great to have a blog post that steps through the process of 
> creating a new package to follow.

You can place many package recipes in a module file.  In fact, that's
how I'm doing it for the bioinformatics packages in Guix:

  http://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/bioinformatics.scm

This file is located in $SOMEWHERE/gnu/packages/bioinformatics.scm and
the module declaration reflects this hierarchical structure:

  (define-module (gnu packages bioinformatics)
    #:use-module ((guix licenses) #:prefix license:)
    #:use-module (guix packages)
    ...)

Let's say $SOMEWHERE is /home/ben/guix-stuff/ and you have the following
directory tree in $SOMEWHERE:

    /home/ben/guix-stuff/
               |
               `-- /ben/
                     |
                     `-- /packages/

Then you can place a file "stuff.scm" in there which defines a
module as such:

  (define-module (ben packages stuff)
    ...)

To allow Guix to find it you need to include $SOMEWHERE in
GUIX_PACKAGE_PATH, e.g.:

  export GUIX_PACKAGE_PATH=/home/ben/guix-stuff

For package recipes that I don't intend to add to GNU Guix upstream for
license reasons I have a module (bimsb packages bioinformatics) defined
in $SOMEWHERE/bimsb/packages/bioinformatics.scm and GUIX_PACKAGE_PATH is
set to include $SOMEWHERE.

A package named "dinup" with a definition in this module, for example,
can then be installed with

    GUIX_PACKAGE_PATH=$SOMEWHERE guix package -i dinup

You can place many such modules into your directory structure in
$SOMEWHERE or you can append new package recipes to the very same
module.

Note that you can access all other package modules defined in GNU Guix
by just requesting them with

    ...
    #:use-module (gnu packages bioinformatics)
    #:use-module (gnu packages maths)
    ...

in the module declaration.


> Some other problems/notes - Apologies for being wide-ranging.
> * OSX support seems like it would be very pertinent for 
> bioinformaticians, does/will guix support?

OSX is not supported at the moment.  This would require porting.  I
don't have a spare OSX machine available to attempt it, and I don't
think anyone else is working on this at the moment.


> * Installing from gnu hydra is way slow on the underside of the planet, 
> I'm getting DL speeds of 70KB/s. There's no mirrors?

Hydra is a virtual machine on an overloaded host.  It's a know problem,
and upgrading Hydra is planned as far as I know, but I don't know where
it's stuck right now.  There are no mirrors known to me.  The thing is
that with Guix we're not just distributing binary packages but recipes
that can be built and whose cached results can be exported.  With "guix
publish" it is already possible for individuals to share store items,
and it's also possible to export and import store items with "guix
archive".

Binary substitutes are optional, so it is possible to build all software
locally, but that's probably not convenient unless you have access to
some powerful machines.


> * For some reason my per-user profile is a broken soft-link:

The profile (link) to the current profile in the store is created when a
first package has been installed to it.


> For completism's sake, here is my (quite buggy I'm sure) recipe, and log 
> of my install of guix.
>
> (define-module (gnu packages orfm)
>    #:use-module (guix packages)
>    #:use-module (guix download)
>    #:use-module (guix build-system gnu)
>    #:use-module (guix licenses))
>
> (define-public orfm
>    (package
>      (name "orfm")
>      (version "0.2.0")
>      (source (origin
>               (method url-fetch)
>               (uri (string-append 
> https://github.com/wwood/OrfM/archive/v" version ".tar.gz))
>               (sha256
>                (base32 
> "7141fd43ecef8e5f5779127c460020449e48d361355d00e16d421fe4b8af00a2"))))
>      (build-system gnu-build-system)
>      (synopsis "Simple and not slow open reading frame (ORF) caller")
>      (description "An ORF caller finds stretches of DNA that when 
> translated are not interrupted by stop codons. OrfM finds and prints 
> these ORFs.")
>      (home-page "https://github.com/wwood/OrfM")
>      (license lgpl3+)))

This looks good! ...with the exception of the missing string delimiters
in (uri (string-append ...)).  It should be

    (uri (string-append 
           "https://github.com/wwood/OrfM/archive/v"
           version ".tar.gz"))

You may also want to add

    (file-name (string-append name "-" version ".tar.gz"))

after the (uri ...) expression, because otherwise your store will
contain a file called "v0.2.0.tar.gz" instead of "orfm-0.2.0.tar.gz",
which may be confusing.  But that's not really important.

With the module definition as "(gnu packages orfm)" the file path would
have to be

   ./gnu/packages/orfm.scm

and the directory containing this must be added to GUIX_PACKAGE_PATH (or
else it would have to be in the very same directory as the Guix upstream
package modules).

I hope this helped!

~~ Ricardo


More information about the bio-packaging mailing list