unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Pierre Neidhardt <mail@ambrevar.xyz>
Cc: guix-devel <guix-devel@gnu.org>, guix-blog@gnu.org
Subject: Re: Blog: Guix packaging tutorial
Date: Thu, 27 Sep 2018 15:43:46 +0200	[thread overview]
Message-ID: <87lg7n3vjh.fsf@gnu.org> (raw)
In-Reply-To: <87mus6iypf.fsf@ambrevar.xyz> (Pierre Neidhardt's message of "Mon, 24 Sep 2018 19:37:16 +0200")

Hi Pierre,

Thanks a lot for writing this tutorial!  I think it’ll be very useful to
many.

Pierre Neidhardt <mail@ambrevar.xyz> skribis:

> Let me know if it's approachable enough and if you find any missing/tangled
> parts in the progression.

I’m not in a good position to say if it’s approachable I’m afraid.  :-)
It would be nice to get feedback from newcomers or users of other
packaging tools.

It’s a bit long indeed, but I think it covers lots of useful things,
going from simple packages to more complex things.  So overall I think
it’s very good and nicely complements our doc!

Some inline comments below, but nothing crucial.

> #+TITLE: Guix packaging tutorial
> #+AUTHOR: Pierre Neidhardt
> #+date: <2018-09-24 Mon>

[...]

> Package definitions are also written in Scheme, which empowers Guix in some very

Perhaps link to
<https://www.gnu.org/software/guix/manual/en/html_node/Defining-Packages.html>.
This part overlaps with the “Defining Packages” section, but it probably
doesn’t hurt.

> unique ways, unlike most other package managers that use shell scripts or
> simplistic languages.

s/simplistic/simple/ (let’s not be judgmental)

> - build-system :: This is where the power of abstraction provided by the Scheme
>                   language really shine: in this case, the ~gnu-build-system~

s/shine/shines/

>                   the ~emacs-build-system~, and many more.

[[https://www.gnu.org/software/guix/manual/en/html_node/Build-Systems.html][and many more]]

> Guix uses the Guile implementation of Scheme.  To start playing with the
> language, install it with ~guix package --install guile~ and start a [[https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop][REPL]] by
> running ~guile~ from the commandline.

s/commandline/command line/

Maybe link to
<https://www.gnu.org/software/guile/manual/html_node/Using-Guile-Interactively.html>
for the REPL.

> - The keyword syntax is ~#:~, it is used to create unique identifiers.  See also
>   http://practical-scheme.net/wiliki/schemexref.cgi?keyword%3F.

Rather link to
<https://www.gnu.org/software/guile/manual/html_node/Keywords.html> as
each Scheme has its own flavor of keywords…

> - The percentage ~%~ is conventionally used as a prefix for variables generated
>   in scope.

s/conventionally.*/typically used for read-only global variables/

(it’s a disputed convention :-))

> *** GUIX_PACKAGE_PATH

You’ll have to mention that the upcoming Guix version features a new
mechanism, “channels”, which provides better integration and provenance
tracking than ‘GUIX_PACKAGE_PATH’.  :-)

> *** Direct checkout hacking
>
> Working directly on the Guix project is recommended: it reduces the friction
> when the time comes to submit your changes upstream to let the community benefit
> from your hard work!
>
> Check out the official [[https://git-scm.com/][Git]] repository:
>
> #+BEGIN_SRC sh
> $ git clone https://git.savannah.gnu.org/git/guix.git
> #+END_SRC

Maybe we should mention that the repo contains both
Guix-the-tools/libraries and the package definitions?  This often comes
as a surprise to people used to toolsets where both are clearly
separate, such as APT vs. Debian packages.


[...]

>       (build-system gnu-build-system)
>       (native-inputs
>        `(("pkg-config" ,pkg-config)))
>       (inputs
>        `(("libbsd" ,libbsd)
>          ("ncurses" ,ncurses)))
>       (propagated-inputs
>        `(("mg-extensions"
>           ,(origin
>              (method url-fetch)
>              (uri "https://example.org/~doe/mg-extensions.tar.gz"
>              (sha256
>               (base32
>                "0kfhpj5rnh24hz2714qhfmxk281vwc2w50sm73ggw5d15af7zfsw"))))))

It doesn’t make much sense to propagate a tarball, does it?

>       (arguments
>        '(#:tests? #f ; No test suite available.
>          #:make-flags (list (string-append "prefix=" %output)
>                             "CC=gcc")
>          #:configure-flags `(,(string-append "--with-ext="
>                                              (assoc-ref %build-inputs "mg-extensions")))

I recommend using ‘list’ rather than quasiquote/unquote here.

> There are 3 different input types.  In short:

Perhaps link to
<https://www.gnu.org/software/guix/manual/en/html_node/package-Reference.html>?

> ** Code staging
>
> The astute reader may have noticed the quasi-quote and comma syntax in the
> argument field.  Indeed, the build code in the package declaration should not be
> evaluated on the client side, but only when passed to the Guix daemon.  This
> mechanism of passing code around two running processes is called [[https://arxiv.org/abs/1709.00833][code staging]].
> See [[https://www.gnu.org/software/guix/manual/en/html_node/G_002dExpressions.html][the "G-Expressions" chapter]] from the manual.

Though precisely package definitions don’t use gexps yet…  Not sure if
we should mention it; maybe it’s outside the scope of this tutorial.

> ** Module prefix
>
> The license now needs a prefix: this is because of how the ~license~ module was
> important in the package, as ~#:use-module ((guix licenses) #:prefix
> license:)~.  This gives the user full control over namespacing.

Perhaps mention that the prefix is needed to avoid classes between,
say, the ‘zlib’ variable from licenses.scm and the ‘zlib’ variable from
compression.scm?

Perhaps you can link to
<https://www.gnu.org/software/guile/manual/html_node/Using-Guile-Modules.html>.

> See https://guix.info/contact/ for the mailing lists, IRC, etc.

For now please use gnu.org/software/guix URLs.

> * References
>
> - [[https://gitlab.com/pjotrp/guix-notes/blob/master/HACKING.org][Pjotr’s hacking guide to GNU Guix]]
>
> - "Guix Guix: Package without a scheme!", by Andreas Enge (in
>   =guix-maintenance.git/talks/ghm-2013/andreas/slides.pdf=)

And the “Defining Packages” section of the manual!  ;-)

Thank you!

Ludo’.

  reply	other threads:[~2018-09-27 13:44 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-13 10:50 Blog: Guix packaging tutorial Pierre Neidhardt
2018-09-13 11:16 ` Pjotr Prins
2018-09-13 11:53 ` Ricardo Wurmus
2018-09-13 12:04   ` Pjotr Prins
2018-09-13 19:11 ` Andreas Enge
2018-09-14 11:07   ` Pierre Neidhardt
2018-09-14 11:33     ` Pjotr Prins
2018-09-24 17:00       ` Pierre Neidhardt
2018-09-24 17:37         ` Pierre Neidhardt
2018-09-27 13:43           ` Ludovic Courtès [this message]
2018-09-27 17:34             ` Pierre Neidhardt
2018-09-29 16:28               ` Ludovic Courtès
2018-09-29 21:18           ` Ricardo Wurmus
2018-09-30 19:01             ` Pierre Neidhardt
2018-09-30 19:44               ` Ludovic Courtès
2018-09-30 21:14                 ` Pierre Neidhardt
2018-10-02 12:12                   ` Ludovic Courtès
2018-10-02 16:02                     ` Pierre Neidhardt
2018-10-02 19:46                       ` Ricardo Wurmus
2018-10-03  8:10                         ` Pierre Neidhardt
2018-10-03 18:16                           ` Pierre Neidhardt
2018-10-08 12:20                             ` Ludovic Courtès
2018-10-08 15:18                             ` Ricardo Wurmus
2018-10-08 18:41                               ` Pierre Neidhardt
2018-10-08 19:06                                 ` Pierre Neidhardt
2018-10-08 19:59                                 ` Ricardo Wurmus
2018-10-08 22:09                                   ` Pierre Neidhardt
2018-10-08 22:33                                     ` Pierre Neidhardt
2018-10-08 23:45                                       ` Pierre Neidhardt
2018-10-10 11:56                                         ` Ludovic Courtès
2018-10-10 13:20                                           ` George Clemmer
2018-10-10 13:31                                             ` Pierre Neidhardt
2018-10-10 14:13                                               ` Ricardo Wurmus
2018-10-10 14:00                                         ` Guix packaging tutorial is on-line! Ludovic Courtès
2018-10-10 14:12                                           ` Pierre Neidhardt
2018-10-10 15:07                                             ` Ricardo Wurmus
2018-10-10 16:09                                               ` Pierre Neidhardt
2018-10-11 13:41                                             ` Ludovic Courtès
2018-10-11 16:34                                               ` Pierre Neidhardt
2018-10-11 16:51                                                 ` Pierre Neidhardt
2018-10-15 12:02                                                   ` Ludovic Courtès
2018-10-15 12:39                                                     ` Pierre Neidhardt
2018-10-20 19:58                                         ` Blog: Guix packaging tutorial Divan
2018-10-21 10:30                                           ` Pierre Neidhardt
2018-10-21 11:21                                             ` Pierre Neidhardt
2018-10-22 20:40                                               ` Divan Santana
2018-10-22 21:11                                                 ` Pierre Neidhardt
2018-09-26 10:20         ` Ludovic Courtès
2018-09-26 10:28           ` Pierre Neidhardt
2018-09-27 11:56             ` Ludovic Courtès
  -- strict thread matches above, loose matches on Subject: below --
2018-10-08 22:54 Benjamin Slade
2018-10-08 23:05 ` Pierre Neidhardt
2018-10-09  0:04   ` Benjamin Slade
2018-10-10  9:02     ` Ludovic Courtès
2018-10-11  1:38       ` Benjamin Slade
2018-10-11  9:37         ` Gábor Boskovits
2018-10-11 13:39         ` Ludovic Courtès
2018-10-12  1:05           ` Benjamin Slade

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=87lg7n3vjh.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guix-blog@gnu.org \
    --cc=guix-devel@gnu.org \
    --cc=mail@ambrevar.xyz \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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).