unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: swedebugia <swedebugia@riseup.net>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel <guix-devel@gnu.org>
Subject: Re: Article: Playing with Guix REPL from scratch
Date: Sun, 06 Jan 2019 04:24:33 +0100	[thread overview]
Message-ID: <88236E68-9FB3-4CE1-B8CE-9D1D60828D1B@pretty.Easy.privacy> (raw)
In-Reply-To: <815ec957-58a6-1b17-646a-457217ea7851@riseup.net>; <874lan3t15.fsf@gnu.org>;


[-- Attachment #1.1: Type: text/html, Size: 6373 bytes --]

[-- Attachment #1.2: Type: text/plain, Size: 5004 bytes --]

"Ludovic Courtès" <ludo@gnu.org> skrev: (5 januari 2019 18:37:10 CET)
>Hello swedebugia,
>
>Sorry for the late reply!
>
>swedebugia <swedebugia@riseup.net> 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 “REPL” mean? 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’s an option, but you could mention that one can install Guix or
>GuixSD and run ‘guix repl’ 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=$HOME/.guix-profile/share/guile/site/2.2:/run/current-system/profile/share/guile/site/2.2
>>  $ export SSL_CERT_DIR=/root/.guix-profile/etc/ssl/certs
>
>I don’t think GUILE_LOAD_PATH is needed if you use ‘guix repl’.
>
>> 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’d 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<TAB><TAB> 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 <derivation> 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     #<procedure origin->derivation
>(origin #:optional system)>
>(guix packages): origin-snippet
>(guix packages): origin-modules
>(guix packages): origin-actual-file-name        #<procedure
>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’t seem to work if you only use (guix),
>hmm…
>
>> scheme@(guile-user)> (define snakes
>>                        (fold-packages
>>                             (lambda (package lst)
>>                               	(if (string-prefix? "python"
>>                                       (package-name package))
>> 				       (cons (origin-url package) lst)
>> 			     lst))
>> 			'()))
>
>‘origin-url’ does not exist.  :-)  Make sure all the examples work so
>that users are not disappointed.  It may be worth explaining how
>‘fold-packages’ works as it may be the first encounter of ‘fold’ for
>someone not familiar with functional programming.
>
>Perhaps you could give another examples or two such as using
>‘package-derivation’ and ‘build-derivations’, or integration with (guix
>swh) as sketched at
><https://lists.gnu.org/archive/html/guix-devel/2018-11/msg00285.html>,
>or uses of ‘package-input-rewriting’, just to give a feel that it’s
>actually useful.  ;-)
>
>For the blog we write text in Markdown and there’s markup to get proper
>syntax highlighting for Scheme.  See the .md files at
><https://git.savannah.gnu.org/cgit/guix/guix-artwork.git/tree/website/posts>.
>
>Also I think it’s 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’.

Wow, thanks a lot for the suggestions. I did not know about apropos and I found the tab-completion by accident. 
I still got much to learn about the repl which seem to have all kinds of neat (a bit hidden) eggs 😃

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.g. import commands?
-- 
Sent from my p≡p for Android.

[-- Attachment #2: pEpkey.asc --]
[-- Type: application/pgp-keys, Size: 3825 bytes --]

  reply	other threads:[~2019-01-06  3:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-25 11:47 Article: Playing with Guix REPL from scratch swedebugia
2018-12-25 18:01 ` swedebugia
2019-01-05 17:37 ` Ludovic Courtès
2019-01-06  3:24   ` swedebugia [this message]
2019-01-06 11:36     ` Pierre Neidhardt
2019-01-08 16:25       ` Ludovic Courtès
2019-01-10  7:46     ` Chris Marusich
2019-01-13 21:52       ` Ludovic Courtès
2019-01-14  9:44         ` Chris Marusich
2019-01-15 22:32           ` Ludovic Courtès
2019-01-23  1:52             ` Chris Marusich
2019-01-23 11:11               ` Ludovic Courtès

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=88236E68-9FB3-4CE1-B8CE-9D1D60828D1B@pretty.Easy.privacy \
    --to=swedebugia@riseup.net \
    --cc=guix-devel@gnu.org \
    --cc=ludo@gnu.org \
    /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).