From mboxrd@z Thu Jan 1 00:00:00 1970 From: swedebugia Subject: Re: Article: Playing with Guix REPL from scratch Date: Sun, 06 Jan 2019 04:24:33 +0100 Message-ID: <88236E68-9FB3-4CE1-B8CE-9D1D60828D1B@pretty.Easy.privacy> References: <815ec957-58a6-1b17-646a-457217ea7851@riseup.net>; <874lan3t15.fsf@gnu.org>; Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----YNXMUNBFHPI81R2UUZJ3MOA48CLWNB" Content-Transfer-Encoding: 7bit Return-path: Received: from eggsout.gnu.org ([209.51.188.92]:52529 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gfz3O-00089m-5p for guix-devel@gnu.org; Sat, 05 Jan 2019 22:24:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gfz3J-0005pB-A2 for guix-devel@gnu.org; Sat, 05 Jan 2019 22:24:45 -0500 In-Reply-To: <815ec957-58a6-1b17-646a-457217ea7851@riseup.net>; <874lan3t15.fsf@gnu.org>; 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: =?ISO-8859-1?Q?Ludovic_Court=E8s?= Cc: guix-devel ------YNXMUNBFHPI81R2UUZJ3MOA48CLWNB Content-Type: multipart/alternative; boundary="----ZRB2QV66JVNQ736Q4U0SV3VHRFLHRC" Content-Transfer-Encoding: 7bit ------ZRB2QV66JVNQ736Q4U0SV3VHRFLHRC Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
"Ludovic Court=C3= =A8s" <ludo@gnu=2Eorg> skrev: (5 januari 2019 18:37:10 CET)
Hello swedebugia,

Sorry for the late reply!
swedebugia <swedebugia@riseup=2Enet> 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 s= uggest adding a bit of context: what does =E2=80=9CREPL=E2=80=9D mean? what= are
the possible use cases? how does it differ from what other package<= br>managers provide? etc=2E

This is a small example of how to quickly get an environment to = play
with Guix in guile=2E

First setup your environment=2E
<= br> I choose a x86_64 PC and booted up the installer from an usb stick=2E

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 the= re=2E

This is a ni= ce environment because it already is running GuixSD in a
console and yo= u have are in Guix land with 8500 packages at your
fingertips=2E
I started by installing a sensible array of packages:

$ guix pac= kage -i emacs-no-x lynx git-minimal guile-readline
guile-colorized emac= s-paredit nss-certs

To set this up as intended then run:

$= export
GUILE_LOAD_PATH=3D$HOME/=2Eguix-profile/share/guile/site/2=2E2:= /run/current-system/profile/share/guile/site/2=2E2
$ export SSL_CERT_D= IR=3D/root/=2Eguix-profile/etc/ssl/certs

I don=E2=80=99= t think GUILE_LOAD_PATH is needed if you use =E2=80=98guix repl=E2=80=99=2E=

Now fire up the g= uix repl with

$guix repl

Load e=2Eg=2E this to start hacki= ng on package records:

(use-modules
(guix packages)
(guix= import utils)
(gnu)
(gnu packages sync))

I= =E2=80=99d suggest (guix) instead of (guix packages)=2E

Now you can start hacking on all pack= ages in sync=2Escm using Scheme
procedures from (gnu packages) (see the= source of this module for
details or guess and press tab)

E=2E= g=2E (package<TAB><TAB> shows this list of nice procedures avai= liable:
package
package->cross-derivation

[= =2E=2E=2E]

What ca= n we do with this you might ask?

You could show ,descri= be and ,apropos at the REPL:

--8<---------------cut here---------= ------start------------->8---
scheme@(guix-user)> ,describe packag= e-derivation
Return the <derivation> object of PACKAGE for SYSTEM= =2E
scheme@(guix-user)> ,a origin
(guix packages): origin-patch-gu= ile
(guix packages): origin-method
(guix packages): origin-patch-inpu= ts
(guix packages): origin-patch-flags
(guix packages): origin-patche= s
(guix packages): origin->derivation #<procedure origin->d= erivation (origin #:optional system)>
(guix packages): origin-snippet=
(guix packages): origin-modules
(guix packages): origin-actual-file-= name #<procedure origin-actual-file-name (origin)>
(guix pa= ckages): origin
(guix packages): origin-uri
(guix packages): origin?<= br>(guix packages): origin-file-name
(guix packages): origin-sha256
-= -8<---------------cut here---------------end--------------->8---
<= br>Though for some reason ,a doesn=E2=80=99t seem to work if you only use (= guix),
hmm=E2=80=A6

scheme@(guile-user)> (define snakes
(fol= d-packages
(lambda (package lst)
= (if (string-prefix? "python"
= (package-name package))
(cons (origin-u= rl package) lst)
lst))
'()))

=E2=80= =98origin-url=E2=80=99 does not exist=2E :-) Make sure all the examples w= ork so
that users are not disappointed=2E It may be worth explaining ho= w
=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 prog= ramming=2E

Perhaps you could give another examples or two such as us= ing
=E2=80=98package-derivation=E2=80=99 and =E2=80=98build-derivations= =E2=80=99, or integration with (guix
swh) as sketched at
<https://= lists=2Egnu=2Eorg/archive/html/guix-devel/2018-11/msg00285=2Ehtml>,
o= r uses of =E2=80=98package-input-rewriting=E2=80=99, just to give a feel th= at it=E2=80=99s
actually useful=2E ;-)

For the blog we write tex= t in Markdown and there=E2=80=99s markup to get proper
syntax highlighti= ng for Scheme=2E See the =2Emd files at
<https://git=2Esavannah=2Egn= u=2Eorg/cgit/guix/guix-artwork=2Egit/tree/website/posts>=2E

Also = I think it=E2=80=99s a good idea to add links to the relevant parts of the<= br>Guix and Guile manuals so that interested readers know where to find
= more info about each topic=2E

Thanks for working on it!

Ludo= =E2=80=99=2E

Wow, thanks a lo= t for the suggestions=2E I did not know about apropos and I found the tab-c= ompletion by accident=2E
I still got much to learn about the repl which seem to have all kinds of n= eat (a bit hidden) eggs =F0=9F=98=83

An ideas pop to mind:
1) the repl could hint at startup about some feature

A question too:
2) are there ways to hinder gnutls from flooding the ,trace of e=2Eg=2E im= port commands?
--
Sent from my p=E2=89=A1p for Android=2E
------ZRB2QV66JVNQ736Q4U0SV3VHRFLHRC Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable "Ludovic Court=C3=A8s" skrev: (5 januari 2019 18:37:10 CET= ) >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= mean? what >are >the possible use cases? how does it differ from what other package >managers provide? etc=2E > >> This is a small example of how to quickly get an environment to play >> with Guix in guile=2E >> >> First setup your environment=2E >> >> I choose a x86_64 PC and booted up the installer from an usb stick=2E > >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=2E > >> 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=2E >> >> 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/=2Eguix-profile/share/guile/site/2=2E2:/run/curre= nt-system/profile/share/guile/site/2=2E2 >> $ export SSL_CERT_DIR=3D/root/=2Eguix-profile/etc/ssl/certs > >I don=E2=80=99t think GUILE_LOAD_PATH is needed if you use =E2=80=98guix = repl=E2=80=99=2E > >> Now fire up the guix repl with >> >> $guix repl >> >> Load e=2Eg=2E 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)=2E > >> Now you can start hacking on all packages in sync=2Escm using Scheme >> procedures from (gnu packages) (see the source of this module for >> details or guess and press tab) >> >> E=2Eg=2E (package shows this list of nice procedures >availiable: >> package >> package->cross-derivation > >[=2E=2E=2E] > >> 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=2E >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 >(origin #:optional system)> >(guix packages): origin-snippet >(guix packages): origin-modules >(guix packages): origin-actual-file-name #origin-actual-file-name (origin)> >(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 (g= uix), >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=2E :-) Make sure all the ex= amples work so >that users are not disappointed=2E 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=2E > >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= that it=E2=80=99s >actually useful=2E ;-) > >For the blog we write text in Markdown and there=E2=80=99s markup to get = proper >syntax highlighting for Scheme=2E See the =2Emd files at >=2E > >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=2E > >Thanks for working on it! > >Ludo=E2=80=99=2E Wow, thanks a lot for the suggestions=2E I did not know about apropos and = I found the tab-completion by accident=2E=20 I still got much to learn about the repl which seem to have all kinds of n= eat (a bit hidden) eggs =F0=9F=98=83 An ideas pop to mind: 1) the repl could hint at startup about some feature A question too: 2) are there ways to hinder gnutls from flooding the ,trace of e=2Eg=2E im= port commands? --=20 Sent from my p=E2=89=A1p for Android=2E ------ZRB2QV66JVNQ736Q4U0SV3VHRFLHRC-- ------YNXMUNBFHPI81R2UUZJ3MOA48CLWNB Content-Type: application/pgp-keys; name="pEpkey.asc" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="pEpkey.asc"; size=3825 LS0tLS1CRUdJTiBQR1AgUFVCTElDIEtFWSBCTE9DSy0tLS0tCgptUUlOQkZ3Y25XMEJFQURhNWti U0t0ZEd6ZzQ1SjZkQnRFS21lZFM2bEtEQkx1UmlNZTRTNHppTFVMaVV5RTlWCmVNeTA0TUUzbFN6 WHg4TlpSNjVxSzdENDRhVlRvV29iUlcxMEhGWi9YOWh5bFlrcnFzUk45cndieW5mOTFrcU0KcVI2 TkRxQjJKRHZTek9LRzM0U2dnTzVkVGh1RE1GdzNmT3Z1cGhtSnN5b2s3OGVYQlFqTkxyaXNvQnhT SEFyVgpzZjdIMlJIYlNmTmZaclMxaEtUUzRtbFBpNnJZS2ZFMUFvbm8wdUs5SnVVZHBTTyswODdV ejhRam5GVTE5c09BClJWTWtUTnpuZk12MHVzeUsxSzc5U2pjYzJjTzhkNDRUalJlTGkxcFlHMjBV OHhtQXBpRlJhRXhaOHlyR3c5RTkKYm9CcVo2TUZoNjhQWFNQa0ZjMWhTQ3BUV0xVZW1ZdEFrMkpE RHo4R1EwYWNRNU1aMlRJSzZJR0RCaEw4b0xCNwo2anZOMlBVYUN3VmFDYUNwS1JncU9Fd2dvdDBr MlFZRnZkODZUM0kwYVVNMDkzYVZ6aWdmUnYzaDlaMFhINytUCmZickhxalMrUlZTcjVKYytVeGox KzlqWEFQeEllVmRqMWpIOXE2ejJ2Z3UzSHRpaXlsQUp4SlFhUFFEZkhHQzEKNm9HODBwd3JoWWFj Q3JPT2QxUWhwZzhSOUlsaUQ4bU85WERTcHZoNGo2UFpXY1F6YWRYOFl5b3Z0UDNLS1B1dQpUM0h0 UDRmcXJhVmIzV2p2Si9ST0E3aTd5UHhGMTk4TExyKy9kMC9uamEvZHlWTjNHam1BellaL2dnZTdW aHp1CmZ2SFNGNFdLWWRFWFZWZzBhRjFVZ2FyTW1BaTUyNlhzTm1QRDU4cHdwc2h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