How to package software for #Guix (2)
This serie of blog posts is an invitation to see how one can learn how to package software for Guix. Without prior knowledge about Guix or even software packaging, I show you what resources are needed and how to use them. My method is driven by doing. The commands execution rhythms my iterations and its return guides the code to produce and the use of external resources (documentation, source code, community).
In this article, I continue the work of the previous one.
In the Guix repository you've cloned in the first article of this serie, do the following :
$ git pull
$ guix environment --pure guix
[dev]$ ./bootstrap && ./configure --localstatedir=/var && make
You now have an up-to-date stuff.
I retrieve the last commands executed (the first one to create a package definition, the second to build the package according to the definition):
$ echo '(use-modules (guix packages)) (package (name "") (version "") source build-system synopsis description license home-page)' > /tmp/dummy-package-definition.scm
$ ./pre-inst-env guix build -f /tmp/dummy-package-definition.scm
/tmp/dummy-package-definition.scm:1:30: error: source: invalid field specifier
Right! The source
field of the package
object is incorrectly specified. How do you specify it? I don't know yet.
Lets have a look at the Guix documentation about it. I can read that the source
field needs an `origin' object. Let's try this without looking further.
$ echo '(use-modules (guix packages)) (package (name "") (version "") (source origin) build-system synopsis description license home-page)' > /tmp/dummy-package-definition.scm
$ ./pre-inst-env guix build -f /tmp/dummy-package-definition.scm
/tmp/dummy-package-definition.scm:1:30: error: build-system: invalid field specifier
That seems enough for Guix concerning the source
field. Now, Guix point the build-system
field out. A little tour in the appropriate section in the documentation, where I learn this field needs to be specified with one of many build systems. One could be appropriate for my package so I'm trying it out : emacs-buid-system
. I don't forget to add the (guix build-system emacs)
dependency as specified in the documentation.
$ echo '(use-modules (guix packages) (guix build-system emacs)) (package (name "") (version "") (source origin) (build-system emacs-build-system) synopsis description license home-page)' > /tmp/dummy-package-definition.scm
$ ./pre-inst-env guix build -f /tmp/dummy-package-definition.scm
/tmp/dummy-package-definition.scm:1:56: error: synopsis: invalid field specifier
Guix isn't complaining, so I can move on to the next field: synopsis
. The documentation doesn't specify what type of data is expected, but given the field name, I'll bet on a string.
$ echo '(use-modules (guix packages) (guix build-system emacs)) (package (name "") (version "") (source origin) (build-system emacs-build-system) (synopsis "") description license home-page)' > /tmp/dummy-package-definition.scm
$ ./pre-inst-env guix build -f /tmp/dummy-package-definition.scm
Ditto for description
!
$ echo '(use-modules (guix packages) (guix build-system emacs)) (package (name "") (version "") (source origin) (build-system emacs-build-system) (synopsis "") (description "") license home-page)' > /tmp/dummy-package-definition.scm
$ ./pre-inst-env guix build -f /tmp/dummy-package-definition.scm
/tmp/dummy-package-definition.scm:1:56: error: license: invalid field specifier
No worries, Guix is still satisfied. In the next article, I will start by fixing the license
field !
Here is the definition obtained at this point:
(use-modules
(guix packages)
(guix build-system emacs))
(package
(name "")
(version "")
(source origin)
(build-system emacs-build-system)
(synopsis "")
(description "")
license
home-page)
Thank you so much for reading this article !
Don't hesitate to give me your opinion, leave a comment, or ask a question via :
– E-mail: jeremy AT korwin-zmijowski DOT fr
– Mastodon: @jeko@framapiaf.org
– Peertube: @jeko@video.tedomum.net
– Twitter: @JeremyKorwin
Also, please subscribe so you don't miss the next ones :
– blog via Mastodon @jeko@write.as et RSS
– screencast via Peertube jeko@video.tedomum.net et RSS
And most importantly, share the blog and tell your friends it's the best blog in the history of Free Software! No shit!