21
Foreign packages in GNU Guix Examples from Ruby gems, Python modules and R/CRAN Pjotr Prins & David Thompson FOSDEM January 30th, 2016 UMC Utrecht/UTHSC GeneNetwork.org Foreign packages in GNU Guix – p. 1

Foreign packages in GNU Guix · The GNU Guix python build-system guix package -A python guix package -i python2-parsedatetime Imports from pypi Installs anything with a setup.py Supports

  • Upload
    others

  • View
    23

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Foreign packages in GNU Guix · The GNU Guix python build-system guix package -A python guix package -i python2-parsedatetime Imports from pypi Installs anything with a setup.py Supports

Foreign packages in GNU Guix

Examples from Ruby gems, Python modules and

R/CRAN

Pjotr Prins & David Thompson

FOSDEM

January 30th, 2016

UMC Utrecht/UTHSC GeneNetwork.org

Foreign packages in GNU Guix – p. 1

Page 2: Foreign packages in GNU Guix · The GNU Guix python build-system guix package -A python guix package -i python2-parsedatetime Imports from pypi Installs anything with a setup.py Supports

GNU Guix

What is it to me?

Foreign packages in GNU Guix – p. 2

Page 3: Foreign packages in GNU Guix · The GNU Guix python build-system guix package -A python guix package -i python2-parsedatetime Imports from pypi Installs anything with a setup.py Supports

Holy grail

Controlled software deployment

Control the full dependency graph

Write once and reproduce any time

Understand what is happening

Foreign packages in GNU Guix – p. 3

Page 4: Foreign packages in GNU Guix · The GNU Guix python build-system guix package -A python guix package -i python2-parsedatetime Imports from pypi Installs anything with a setup.py Supports

Foreign packages

What are they?

Foreign packages in GNU Guix – p. 4

Page 5: Foreign packages in GNU Guix · The GNU Guix python build-system guix package -A python guix package -i python2-parsedatetime Imports from pypi Installs anything with a setup.py Supports

Foreign packages?

Non-native guix packages: Perl, Python, Ruby, R

but also emacs, Firefox, etc.

I.e., any tool that wants to install software locally

Foreign packages in GNU Guix – p. 5

Page 6: Foreign packages in GNU Guix · The GNU Guix python build-system guix package -A python guix package -i python2-parsedatetime Imports from pypi Installs anything with a setup.py Supports

Ruby gems

Unpacks gem in global Ruby directory

Or in $GEM_HOME

gem major number versioning

gems are not isolated, not even between ruby versions

rvm, rbenv, bundler try to solve the mess

I got to dislike rvm and bundler with a passion

Foreign packages in GNU Guix – p. 6

Page 7: Foreign packages in GNU Guix · The GNU Guix python build-system guix package -A python guix package -i python2-parsedatetime Imports from pypi Installs anything with a setup.py Supports

Solving the mess

if $GEM_HOME is isolated the gem tool can do the job

/gnu/store/p8ks1l9cl-ruby-2.2.4/bin/ruby -v

ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-linux]

export GEM_HOME=˜/.gem/p8ks1l9cl-ruby-2.2.4/2.2.0

export GEM_PATH=˜/.gem/p8ks1l9cl-ruby-2.2.4/2.2.0

gem install log4r

ruby -e require ’log4r’

Foreign packages in GNU Guix – p. 7

Page 8: Foreign packages in GNU Guix · The GNU Guix python build-system guix package -A python guix package -i python2-parsedatetime Imports from pypi Installs anything with a setup.py Supports

It works!

At this point I am living with a

reproducible modern ruby

no need for rvm, rbenv or bundler

gem works. Gems are isolated but not fullyreproducible

bundler still works

Great for me

Foreign packages in GNU Guix – p. 8

Page 9: Foreign packages in GNU Guix · The GNU Guix python build-system guix package -A python guix package -i python2-parsedatetime Imports from pypi Installs anything with a setup.py Supports

But. . .

I am still not satisfied

Foreign packages in GNU Guix – p. 9

Page 10: Foreign packages in GNU Guix · The GNU Guix python build-system guix package -A python guix package -i python2-parsedatetime Imports from pypi Installs anything with a setup.py Supports

For real

System-wide deployments

Reproducible: when and where should not matter

I.e., we want full control over the depency graph

So, Ruby gems ultimately need to go into GNU Guix

With help from David I started adding ruby gem

support

Foreign packages in GNU Guix – p. 10

Page 11: Foreign packages in GNU Guix · The GNU Guix python build-system guix package -A python guix package -i python2-parsedatetime Imports from pypi Installs anything with a setup.py Supports

Guix gem support

A short code walk

guix/build-system/ruby.scm - defines what a package

should be like

guix/build/ruby-build-system.scm - unpacks and builds the

package

guix/import/ruby.scm - automatically imports gems

gnu/package/ruby.scm - contains Ruby and gems

Foreign packages in GNU Guix – p. 11

Page 12: Foreign packages in GNU Guix · The GNU Guix python build-system guix package -A python guix package -i python2-parsedatetime Imports from pypi Installs anything with a setup.py Supports

Import gem

guix import gem log4r

(package

(name "ruby-log4r")

(version "1.1.10")

(source

(origin

(method url-fetch)

(uri (rubygems-uri "log4r" version))

(sha256

(base32

"0ri90q0frfmigkirqv5ihyrj59xm8pq5zcmf156cbdv4r4l2jicv"))))

(build-system ruby-build-system)

(synopsis

"See also: http://logging.apache.org/log4j")

blah, blah)

Foreign packages in GNU Guix – p. 12

Page 13: Foreign packages in GNU Guix · The GNU Guix python build-system guix package -A python guix package -i python2-parsedatetime Imports from pypi Installs anything with a setup.py Supports

Install gem

guix package -i ruby-log4r

Installs /gnu/store/409cynfy62-ruby-log4r-1.1.10/lib/

Symlinks ˜/.guix-profile/lib/ruby/gems/2.2.0/gems/

guix package - -search-paths

export GEM_PATH=˜/.guix-profile/lib/ruby/gems/2.2.0

ruby -e require ’log4r’

Foreign packages in GNU Guix – p. 13

Page 14: Foreign packages in GNU Guix · The GNU Guix python build-system guix package -A python guix package -i python2-parsedatetime Imports from pypi Installs anything with a setup.py Supports

Done

We have

A fully reproducible ruby

A fully reproducible gem

Write once and deploy anywhere

Foreign packages in GNU Guix – p. 14

Page 15: Foreign packages in GNU Guix · The GNU Guix python build-system guix package -A python guix package -i python2-parsedatetime Imports from pypi Installs anything with a setup.py Supports

Python modules

The GNU Guix python build-system

guix package -A python

guix package -i python2-parsedatetime

Imports from pypi

Installs anything with a setup.py

Supports python3 and python2 with one definition:

(define-public python2-parsedatetime

(package-with-python2 python-parsedatetime))

Foreign packages in GNU Guix – p. 15

Page 16: Foreign packages in GNU Guix · The GNU Guix python build-system guix package -A python guix package -i python2-parsedatetime Imports from pypi Installs anything with a setup.py Supports

R modules

The GNU Guix R build-system

Imports from CRAN

Installs anything on CRAN and bioconductor

R modules are not tied to R releases!

Foreign packages in GNU Guix – p. 16

Page 17: Foreign packages in GNU Guix · The GNU Guix python build-system guix package -A python guix package -i python2-parsedatetime Imports from pypi Installs anything with a setup.py Supports

What is Guix to me?

Dependable software deployment

Reproducible software deployment

Incremental software development

1. As a system administrator (users, versions,

transactions)

2. As a software developer (user support, multiple

versions)

Foreign packages in GNU Guix – p. 17

Page 18: Foreign packages in GNU Guix · The GNU Guix python build-system guix package -A python guix package -i python2-parsedatetime Imports from pypi Installs anything with a setup.py Supports

Debian etc.

How does GNU Guix compare to other popular

distributions?

Versioning is NOT a problem

Multiple targets are NOT a problem (+/- ssl, BLAS/Atlas)

Foreign imports are easy

Packaging is relatively easy

The only dependency is the Linux kernel API

Foreign packages in GNU Guix – p. 18

Page 19: Foreign packages in GNU Guix · The GNU Guix python build-system guix package -A python guix package -i python2-parsedatetime Imports from pypi Installs anything with a setup.py Supports

Docker?

With Docker order and time of software installation

matter

The build is not reproducible

Sending multiple GBs around for a simple thing?

File systems and network policies? At what level

should we care?

You must be MAD to use Docker when there is GNU

Guix

Foreign packages in GNU Guix – p. 19

Page 20: Foreign packages in GNU Guix · The GNU Guix python build-system guix package -A python guix package -i python2-parsedatetime Imports from pypi Installs anything with a setup.py Supports

Conclusion

Adding packages is easy

Guix is hackable - with a bit of LISP adding features

such as foreign package support is surprisingly easy

GNU Guix has the right level of abstraction

See https://github.com/pjotrp/guix-notes

Foreign packages in GNU Guix – p. 20

Page 21: Foreign packages in GNU Guix · The GNU Guix python build-system guix package -A python guix package -i python2-parsedatetime Imports from pypi Installs anything with a setup.py Supports

Acknowledgements

In particular Ludovic Courtès, Ricardo Wurmus, David

Thompson & Ben Woodcroft for suporting Ruby

packaging and the ruby-build-system

The GNU and GNU Guix communities (many, many)

Prof. Rob W. Williams, UTHSC

(http://genenetwork.org/)

Foreign packages in GNU Guix – p. 21