From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: Blog: Guix packaging tutorial Date: Thu, 27 Sep 2018 15:43:46 +0200 Message-ID: <87lg7n3vjh.fsf@gnu.org> References: <87in397jsd.fsf@ambrevar.xyz> <20180913191151.GA1865@jurong> <87woro5ocf.fsf@ambrevar.xyz> <20180914113302.elqrk3tvdkln2cde@thebird.nl> <87o9cmj0fc.fsf@ambrevar.xyz> <87mus6iypf.fsf@ambrevar.xyz> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44930) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5Wae-0007Ri-JS for guix-devel@gnu.org; Thu, 27 Sep 2018 09:44:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g5Waa-0007DR-Bl for guix-devel@gnu.org; Thu, 27 Sep 2018 09:44:24 -0400 In-Reply-To: <87mus6iypf.fsf@ambrevar.xyz> (Pierre Neidhardt's message of "Mon, 24 Sep 2018 19:37:16 +0200") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Pierre Neidhardt Cc: guix-devel , guix-blog@gnu.org Hi Pierre, Thanks a lot for writing this tutorial! I think it=E2=80=99ll be very usef= ul to many. Pierre Neidhardt skribis: > Let me know if it's approachable enough and if you find any missing/tangl= ed > parts in the progression. I=E2=80=99m not in a good position to say if it=E2=80=99s approachable I=E2= =80=99m afraid. :-) It would be nice to get feedback from newcomers or users of other packaging tools. It=E2=80=99s 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=E2=80=99s 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 so= me very Perhaps link to . This part overlaps with the =E2=80=9CDefining Packages=E2=80=9D section, bu= t it probably doesn=E2=80=99t hurt. > unique ways, unlike most other package managers that use shell scripts or > simplistic languages. s/simplistic/simple/ (let=E2=80=99s 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-sys= tem~ 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 [[ht= tps://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 for the REPL. > - The keyword syntax is ~#:~, it is used to create unique identifiers. S= ee also > http://practical-scheme.net/wiliki/schemexref.cgi?keyword%3F. Rather link to as each Scheme has its own flavor of keywords=E2=80=A6 > - The percentage ~%~ is conventionally used as a prefix for variables gen= erated > in scope. s/conventionally.*/typically used for read-only global variables/ (it=E2=80=99s a disputed convention :-)) > *** GUIX_PACKAGE_PATH You=E2=80=99ll have to mention that the upcoming Guix version features a new mechanism, =E2=80=9Cchannels=E2=80=9D, which provides better integration an= d provenance tracking than =E2=80=98GUIX_PACKAGE_PATH=E2=80=99. :-) > *** Direct checkout hacking > > Working directly on the Guix project is recommended: it reduces the frict= ion > 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=E2=80=99t make much sense to propagate a tarball, does it? > (arguments > '(#:tests? #f ; No test suite available. > #:make-flags (list (string-append "prefix=3D" %output) > "CC=3Dgcc") > #:configure-flags `(,(string-append "--with-ext=3D" > (assoc-ref %build-inputs "mg= -extensions"))) I recommend using =E2=80=98list=E2=80=99 rather than quasiquote/unquote her= e. > There are 3 different input types. In short: Perhaps link to ? > ** 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. T= his > 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_002dExpress= ions.html][the "G-Expressions" chapter]] from the manual. Though precisely package definitions don=E2=80=99t use gexps yet=E2=80=A6 = Not sure if we should mention it; maybe it=E2=80=99s outside the scope of this tutorial. > ** Module prefix > > The license now needs a prefix: this is because of how the ~license~ modu= le 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 =E2=80=98zlib=E2=80=99 variable from licenses.scm and the =E2=80= =98zlib=E2=80=99 variable from compression.scm? Perhaps you can link to . > 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= =E2=80=99s hacking guide to GNU Guix]] > > - "Guix Guix: Package without a scheme!", by Andreas Enge (in > =3Dguix-maintenance.git/talks/ghm-2013/andreas/slides.pdf=3D) And the =E2=80=9CDefining Packages=E2=80=9D section of the manual! ;-) Thank you! Ludo=E2=80=99.