From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Subject: Re: Article: Playing with Guix REPL from scratch Date: Sat, 05 Jan 2019 18:37:10 +0100 Message-ID: <874lan3t15.fsf@gnu.org> References: <815ec957-58a6-1b17-646a-457217ea7851@riseup.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggsout.gnu.org ([209.51.188.92]:51120 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gfpsx-00010B-Kb for guix-devel@gnu.org; Sat, 05 Jan 2019 12:37:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gfpsv-00025J-Bk for guix-devel@gnu.org; Sat, 05 Jan 2019 12:37:23 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:39340) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gfpss-0001vB-SZ for guix-devel@gnu.org; Sat, 05 Jan 2019 12:37:20 -0500 In-Reply-To: <815ec957-58a6-1b17-646a-457217ea7851@riseup.net> (swedebugia's message of "Tue, 25 Dec 2018 12:47:49 +0100") 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: swedebugia Cc: guix-devel Hello swedebugia, Sorry for the late reply! swedebugia skribis: > Today I wrote this draft blog post while playing around: > > Playing with Guix REPL from scratch That sounds like a great topic for a blog post! I would suggest adding a bit of context: what does =E2=80=9CREPL=E2=80=9D m= ean? what are the possible use cases? how does it differ from what other package managers provide? etc. > This is a small example of how to quickly get an environment to play > with Guix in guile. > > First setup your environment. > > I choose a x86_64 PC and booted up the installer from an usb stick. That=E2=80=99s an option, but you could mention that one can install Guix or GuixSD and run =E2=80=98guix repl=E2=80=99 from there. > This is a nice environment because it already is running GuixSD in a > console and you have are in Guix land with 8500 packages at your > fingertips. > > I started by installing a sensible array of packages: > > $ guix package -i emacs-no-x lynx git-minimal guile-readline > guile-colorized emacs-paredit nss-certs > > To set this up as intended then run: > > $ export > GUILE_LOAD_PATH=3D$HOME/.guix-profile/share/guile/site/2.2:/run/current-s= ystem/profile/share/guile/site/2.2 > $ export SSL_CERT_DIR=3D/root/.guix-profile/etc/ssl/certs I don=E2=80=99t think GUILE_LOAD_PATH is needed if you use =E2=80=98guix re= pl=E2=80=99. > Now fire up the guix repl with > > $guix repl > > Load e.g. this to start hacking on package records: > > (use-modules > (guix packages) > (guix import utils) > (gnu) > (gnu packages sync)) I=E2=80=99d suggest (guix) instead of (guix packages). > Now you can start hacking on all packages in sync.scm using Scheme > procedures from (gnu packages) (see the source of this module for > details or guess and press tab) > > E.g. (package shows this list of nice procedures availiable: > package > package->cross-derivation [...] > What can we do with this you might ask? You could show ,describe and ,apropos at the REPL: --8<---------------cut here---------------start------------->8--- scheme@(guix-user)> ,describe package-derivation Return the object of PACKAGE for SYSTEM. scheme@(guix-user)> ,a origin (guix packages): origin-patch-guile (guix packages): origin-method (guix packages): origin-patch-inputs (guix packages): origin-patch-flags (guix packages): origin-patches (guix packages): origin->derivation #derivation (ori= gin #:optional system)> (guix packages): origin-snippet (guix packages): origin-modules (guix packages): origin-actual-file-name # (guix packages): origin (guix packages): origin-uri (guix packages): origin? (guix packages): origin-file-name (guix packages): origin-sha256 --8<---------------cut here---------------end--------------->8--- Though for some reason ,a doesn=E2=80=99t seem to work if you only use (gui= x), hmm=E2=80=A6 > scheme@(guile-user)> (define snakes > (fold-packages > (lambda (package lst) > (if (string-prefix? "python" > (package-name package)) > (cons (origin-url package) lst) > lst)) > '())) =E2=80=98origin-url=E2=80=99 does not exist. :-) Make sure all the exampl= es work so that users are not disappointed. It may be worth explaining how =E2=80=98fold-packages=E2=80=99 works as it may be the first encounter of = =E2=80=98fold=E2=80=99 for someone not familiar with functional programming. Perhaps you could give another examples or two such as using =E2=80=98package-derivation=E2=80=99 and =E2=80=98build-derivations=E2=80= =99, or integration with (guix swh) as sketched at , or uses of =E2=80=98package-input-rewriting=E2=80=99, just to give a feel t= hat it=E2=80=99s actually useful. ;-) For the blog we write text in Markdown and there=E2=80=99s markup to get pr= oper syntax highlighting for Scheme. See the .md files at . Also I think it=E2=80=99s a good idea to add links to the relevant parts of= the Guix and Guile manuals so that interested readers know where to find more info about each topic. Thanks for working on it! Ludo=E2=80=99.