GNU bug report logs - #58463
[PATCH] * doc: guix-cookbook: Add a "Guix API usage examples"

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Fulbert <fulbert@HIDDEN>; Keywords: moreinfo patch; dated Wed, 12 Oct 2022 06:37:01 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.
Added tag(s) moreinfo. Request was from Christopher Baines <mail@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 58463 <at> debbugs.gnu.org:


Received: (at 58463) by debbugs.gnu.org; 20 Oct 2022 06:30:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Oct 20 02:30:41 2022
Received: from localhost ([127.0.0.1]:60974 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1olP4j-0002kq-9y
	for submit <at> debbugs.gnu.org; Thu, 20 Oct 2022 02:30:41 -0400
Received: from mailrelay.tugraz.at ([129.27.2.202]:7775)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <liliana.prikler@HIDDEN>) id 1olP4b-0002kc-Pm
 for 58463 <at> debbugs.gnu.org; Thu, 20 Oct 2022 02:30:40 -0400
Received: from lprikler-laptop.ist.intra (gw.ist.tugraz.at [129.27.202.101])
 by mailrelay.tugraz.at (Postfix) with ESMTPSA id 4MtHln69Dhz3wVf;
 Thu, 20 Oct 2022 08:30:29 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at;
 s=mailrelay; t=1666247430;
 bh=GoYqSNTXAIAnTvoDr+ILicDpg/1QphTHqEouRlaVBzo=;
 h=Subject:From:To:Date:In-Reply-To:References;
 b=q+qFvZfX6kGJanBUfiyHb7OXQYkZd6U3zPpgUnOhJDilpZLUslqo7hWkYIhPVGmly
 tEw3Go/uI8xhzs2Bq1GQMd8OgUi5d75AoDV5GWUUc6+9gMmr91KMiBXOiGiTNrGzIY
 VdzrwiGva0c03MnTJcwVrYZnDp5oBk5jGYRd6x9Y=
Message-ID: <88c58e9fe09076e2ea7e29d1424c8f6e47c7d9a8.camel@HIDDEN>
Subject: Re: [bug#58463] [PATCH] * doc: guix-cookbook: Add a "Guix API usage
 examples"
From: Liliana Marie Prikler <liliana.prikler@HIDDEN>
To: zimoun <zimon.toutoune@HIDDEN>, Fulbert <fulbert@HIDDEN>, 
 58463 <at> debbugs.gnu.org
Date: Thu, 20 Oct 2022 08:30:28 +0200
In-Reply-To: <864jw0p1ag.fsf@HIDDEN>
References: <Y0ZhE5Ut44s9VYb9@HIDDEN>
 <b8c5100dba3bfca99dda3b4ffebe570800d17cec.camel@HIDDEN>
 <864jw0p1ag.fsf@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
User-Agent: Evolution 3.46.0 
MIME-Version: 1.0
X-TUG-Backscatter-control: waObeELIUl4ypBWmcn/8wQ
X-Spam-Scanner: SpamAssassin 3.003001 
X-Spam-Score-relay: -1.9
X-Scanned-By: MIMEDefang 2.74 on 129.27.10.116
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 58463
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Am Mittwoch, dem 19.10.2022 um 12:15 +0200 schrieb zimoun:
> Hi Liliana,
>=20
> On Tue, 18 Oct 2022 at 14:09, Liliana Marie Prikler
> <liliana.prikler@HIDDEN> wrote:
>=20
> > I don't think it's useful to write out these timestamps in a way
> > that they're readable to the reader.=C2=A0 They might be fine as
> > comments, but I'd also suggest diverging from simon's structure to
> > accomodate the switch in media (and possibly target audience?)
>=20
> What do you mean with
>=20
> =C2=A0=C2=A0=C2=A0 I'd also suggest diverging from simon's structure to a=
ccomodate
>     the switch in media (and possibly target audience?)
>=20
> ?=C2=A0 The path =E2=80=9Cguix repl=E2=80=9D -> script -> extension appea=
rs to me a nice
> journey.=C2=A0 What would be your suggestion?
I don't have any problem with this part of the structure, the problem
arises when making a literal transcription of the slides.  Revealing
information bit by bit and piecing things together slowly works great
in presentation where these bits of information can be augmented by
your speech and questions asked in between.  In a manual (or cookbook)
however, it makes more sense to first show the complete product and
then deconstruct it into its parts.

Cheers




Information forwarded to guix-patches@HIDDEN:
bug#58463; Package guix-patches. Full text available.

Message received at 58463 <at> debbugs.gnu.org:


Received: (at 58463) by debbugs.gnu.org; 19 Oct 2022 10:15:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 19 06:15:48 2022
Received: from localhost ([127.0.0.1]:55888 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ol672-0003Qt-Dn
	for submit <at> debbugs.gnu.org; Wed, 19 Oct 2022 06:15:48 -0400
Received: from mail-wr1-f49.google.com ([209.85.221.49]:43600)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <zimon.toutoune@HIDDEN>) id 1ol66z-0003QC-0C
 for 58463 <at> debbugs.gnu.org; Wed, 19 Oct 2022 06:15:45 -0400
Received: by mail-wr1-f49.google.com with SMTP id n12so28130143wrp.10
 for <58463 <at> debbugs.gnu.org>; Wed, 19 Oct 2022 03:15:44 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=content-transfer-encoding:mime-version:message-id:date:references
 :in-reply-to:subject:to:from:from:to:cc:subject:date:message-id
 :reply-to; bh=D+XjnbW9iy8kbAZ4jPNHPLBxTdWmIY2vq+ivZVZNuMo=;
 b=XMR+3NtEiP7xeNufa1GDBtqUjh+ykjGQtUsK9gqST+Wy0ogl5i3ICfMHLV4IlK7rOx
 2lQ6qibxbYyiNUAjRH25kmBMFPEypPJA1k7zAVwylWU3O0qJs6eSAbajYNk2tyPdrzcX
 4fZoh8Ep+puDDzS47HWApRauuF5w3gb9EdbjV5b2QkRfbEQcQ815uu6RMbsneFYgO4vo
 zKlBGUnhbF3H6/h8yI5WfW9OfmRVLIf2oAdcxx3ls/y+5yLbjrU08cTQ3VdpqcLqr3er
 MLsaHa8kg4/jVZq1yNc+CStcZcju5QsVBI7XAaUsZoKo8lopiMEX2BUS6reKZgEpxMmK
 rjYA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:mime-version:message-id:date:references
 :in-reply-to:subject:to:from:x-gm-message-state:from:to:cc:subject
 :date:message-id:reply-to;
 bh=D+XjnbW9iy8kbAZ4jPNHPLBxTdWmIY2vq+ivZVZNuMo=;
 b=VHLn+pJkhAltqVus/1dJDxJf8R3V/vItYeafBjOCqJLjTyI5D7AXoJ2K6ytuzw3ft6
 Qj/yQAZbGtAbwt8+Ni4++JHbTQJa7HXp2qLK6NsoUTjmm93jU8JWCok3565oiHN0nUFU
 UFDOumz5PGEVGuDxetnxlyCjXt0W6Yh/P7nazhvrcTEWfPdIoqCjUOoJIdvHkN0I7Y/U
 alXIdGV4ZUHfu4/aHJKYTlRltiyMTiPLy9vaF24Bk/1H10DsNgO88cwgW4vO9Uu9xmH6
 zZzcf9cZcYkJOqWJ4tozYfPsMzUIyhUAJQUkk7A25SM3wRILD0gqXxjT8EjU1ZtD333f
 eDnQ==
X-Gm-Message-State: ACrzQf3TEbEw8wNuOUE5kil8kffrcT8kjOKMgItSmY4M5b8GbucnuIHU
 UQhYhrl3v0P7upDH36qz+3zoTe5t4Vg=
X-Google-Smtp-Source: AMsMyM5mhcoB7hj7auMt+vgo88Wiy38n4KobAWviRngJr7jMy5+RyzUFp0oj8A5IM7jW4EC5CuDy2w==
X-Received: by 2002:adf:fdc6:0:b0:22e:373:939e with SMTP id
 i6-20020adffdc6000000b0022e0373939emr4676560wrs.290.1666174539405; 
 Wed, 19 Oct 2022 03:15:39 -0700 (PDT)
Received: from lili ([2a01:e0a:59b:9120:65d2:2476:f637:db1e])
 by smtp.gmail.com with ESMTPSA id
 k13-20020a5d6d4d000000b0022ac38fb20asm13425216wri.111.2022.10.19.03.15.38
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 19 Oct 2022 03:15:39 -0700 (PDT)
From: zimoun <zimon.toutoune@HIDDEN>
To: Liliana Marie Prikler <liliana.prikler@HIDDEN>, Fulbert
 <fulbert@HIDDEN>, 58463 <at> debbugs.gnu.org
Subject: Re: [bug#58463] [PATCH] * doc: guix-cookbook: Add a "Guix API usage
 examples"
In-Reply-To: <b8c5100dba3bfca99dda3b4ffebe570800d17cec.camel@HIDDEN>
References: <Y0ZhE5Ut44s9VYb9@HIDDEN>
 <b8c5100dba3bfca99dda3b4ffebe570800d17cec.camel@HIDDEN>
Date: Wed, 19 Oct 2022 12:15:19 +0200
Message-ID: <864jw0p1ag.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 58463
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi Liliana,

On Tue, 18 Oct 2022 at 14:09, Liliana Marie Prikler <liliana.prikler@HIDDEN=
graz.at> wrote:

> I don't think it's useful to write out these timestamps in a way that
> they're readable to the reader.  They might be fine as comments, but
> I'd also suggest diverging from simon's structure to accomodate the
> switch in media (and possibly target audience?)

What do you mean with

    I'd also suggest diverging from simon's structure to accomodate the
    switch in media (and possibly target audience?)

?  The path =E2=80=9Cguix repl=E2=80=9D -> script -> extension appears to m=
e a nice
journey.  What would be your suggestion?


Cheers,
simon






Information forwarded to guix-patches@HIDDEN:
bug#58463; Package guix-patches. Full text available.

Message received at 58463 <at> debbugs.gnu.org:


Received: (at 58463) by debbugs.gnu.org; 19 Oct 2022 10:15:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 19 06:15:48 2022
Received: from localhost ([127.0.0.1]:55886 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ol672-0003Qr-4E
	for submit <at> debbugs.gnu.org; Wed, 19 Oct 2022 06:15:48 -0400
Received: from mail-wm1-f51.google.com ([209.85.128.51]:44775)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <zimon.toutoune@HIDDEN>) id 1ol66x-0003QA-Tz
 for 58463 <at> debbugs.gnu.org; Wed, 19 Oct 2022 06:15:44 -0400
Received: by mail-wm1-f51.google.com with SMTP id
 bg9-20020a05600c3c8900b003bf249616b0so14200967wmb.3
 for <58463 <at> debbugs.gnu.org>; Wed, 19 Oct 2022 03:15:43 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=content-transfer-encoding:mime-version:message-id:date:references
 :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id
 :reply-to; bh=j34ra3xHU5phu4TFLPORK2Ol1RwI3eg8I1jrs9PGv9o=;
 b=QoqhN0XngitCX7cTsXqO7JL0OXRtNTKYVDIkt2ZUl9YFRsptG8ZwXkH4eM2NUXyVNu
 ZIT+LGk53eBYhFtaRlhHz6t1IDpuIhegw/Ev0k/BCj5knztVMOH9KK8iTI1jaML0T1mF
 TSQ6PU7MKgz9dX2KXwjDg7bQPEaSkV5LsgoLYhgzktak2+O6sp7pSGYRw5KoU8AMawoY
 SBj/bYAoVljnysRbjWJfNVadkC8IRn2zyPKajF0HOmiWU24lB9ZG2Yx7jxWeMJrRQBeV
 e5nrDpnqbM9CksDy89Xy58c1fX9Xia6RcGaXKdz1Py8ys9PgyS1eP9dhnnvNpxXVjm0r
 b3YQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:mime-version:message-id:date:references
 :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=j34ra3xHU5phu4TFLPORK2Ol1RwI3eg8I1jrs9PGv9o=;
 b=7219PADD0TWz+s3gv1eD2a+gg3oszB3WxgMzTI1U8jlq/AYVV8Ih7/gEjKAmInTXFb
 7f4m9cAYAlHGBqLLCmmSZPLu+JMIAoi0KYI23sZKRUYf8t1GRhf0KAqzQi/KuA6RL99l
 hXoKEX4XlKG05j0hfpwflv47ldE2ctpbFqfEzNw/8+h3jeDUkFl5jjMSWmibCPaQ+3hP
 v7teYggrFQumqElUymFVeinKyuGwmw7Rib8DZQzMh+Lrmo0oQGH82dZ8Dl37Zxi0esxx
 1hSnj2nLKo2b+brtacn5girVHR0lx6OiNwXu/JcSI0xZ6mxbivjnPCXXQ5OMPdvoe9jt
 bm6g==
X-Gm-Message-State: ACrzQf19dLw21O7mzLE+75/zzrT0q1OXVkPpb6Iz9NZfok3xvGAx+6he
 4bmUHVNl00svBDP2fqe2WVR2szRrg6k=
X-Google-Smtp-Source: AMsMyM4+bdVj7ZJTbDg9Zxi3DBNtHlsoxj1+dwHkdR83WDfeL2r662Vh51W+vV4ee8sBoDX99sTDSA==
X-Received: by 2002:a05:600c:548a:b0:3c6:fb49:4f84 with SMTP id
 iv10-20020a05600c548a00b003c6fb494f84mr8023659wmb.153.1666174538319; 
 Wed, 19 Oct 2022 03:15:38 -0700 (PDT)
Received: from lili ([2a01:e0a:59b:9120:65d2:2476:f637:db1e])
 by smtp.gmail.com with ESMTPSA id
 k16-20020a5d6290000000b0022ae4f8395dsm12916798wru.96.2022.10.19.03.15.37
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 19 Oct 2022 03:15:38 -0700 (PDT)
From: zimoun <zimon.toutoune@HIDDEN>
To: Fulbert <fulbert@HIDDEN>, Liliana Marie Prikler
 <liliana.prikler@HIDDEN>
Subject: Re: [bug#58463] [PATCH] * doc: guix-cookbook: Add a "Guix API usage
 examples"
In-Reply-To: <Y0+06VhZPI2y1fp8@HIDDEN>
References: <Y0ZhE5Ut44s9VYb9@HIDDEN>
 <b8c5100dba3bfca99dda3b4ffebe570800d17cec.camel@HIDDEN>
 <Y0+06VhZPI2y1fp8@HIDDEN>
Date: Wed, 19 Oct 2022 12:12:00 +0200
Message-ID: <86a65sp1fz.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 58463
Cc: 58463 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi Flubert,

On Wed, 19 Oct 2022 at 10:27, Fulbert <fulbert@HIDDEN> wrote:
> Le Tue, Oct 18, 2022 at 02:09:57PM +0200, Liliana Marie Prikler a =C3=A9c=
rit :

> As it stands, it's only a proposal and I don't want to spend more
> time on it unless I am sure Guix [doc] maintainers think it would
> make a relevant addition to the Docbook.

I am preparing a v2 based on your patch including Liliana suggestions;
since I have similar or complementary remarks. :-)


Cheers,
simon




Information forwarded to guix-patches@HIDDEN:
bug#58463; Package guix-patches. Full text available.

Message received at 58463 <at> debbugs.gnu.org:


Received: (at 58463) by debbugs.gnu.org; 19 Oct 2022 08:27:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 19 04:27:34 2022
Received: from localhost ([127.0.0.1]:55734 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ol4QI-0000Xw-4s
	for submit <at> debbugs.gnu.org; Wed, 19 Oct 2022 04:27:34 -0400
Received: from vimdzmsp-sfwd01.bluewin.ch ([195.186.120.131]:43258)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <fulbert@HIDDEN>) id 1ol4QF-0000Xi-Fi
 for 58463 <at> debbugs.gnu.org; Wed, 19 Oct 2022 04:27:32 -0400
Received: from bluewin.ch ([213.55.244.21])
 by vimdzmsp-sfwd01.bluewin.ch Swisscom AG with ESMTPA
 id l4Q5oDcmZaSptl4Q6o2Rax; Wed, 19 Oct 2022 10:27:25 +0200
X-Bluewin-Spam-Analysis: v=2.4 cv=XueZhXJ9 c=1 sm=1 tr=0 ts=634fb4ed
 a=okETWHrkPlANAx00SlWV7w==:117 a=IkcTkHD0fZMA:10 a=K1DGZSwWC4ovxIWlpGcA:9
 a=QEXdDO2ut3YA:10
X-Bluewin-Spam-Score: 0.00
X-FXIT-IP: IPv4[213.55.244.21] Epoch[1666168045]
X-Bluewin-AuthAs: fulbert@HIDDEN
Date: Wed, 19 Oct 2022 10:27:21 +0200
From: Fulbert <fulbert@HIDDEN>
To: Liliana Marie Prikler <liliana.prikler@HIDDEN>
Subject: Re: [PATCH] * doc: guix-cookbook: Add a "Guix API usage examples"
Message-ID: <Y0+06VhZPI2y1fp8@HIDDEN>
References: <Y0ZhE5Ut44s9VYb9@HIDDEN>
 <b8c5100dba3bfca99dda3b4ffebe570800d17cec.camel@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <b8c5100dba3bfca99dda3b4ffebe570800d17cec.camel@HIDDEN>
X-CMAE-Envelope: MS4xfEDEiNMgLBrNEeG5wicxBzwNg8QxCwvqfIRWSwBGQgWZv5v4Zglb5/AsXcm0oimxvRVoxHSo9eFS1LYPQLFv8RfDfLm38Xni/jT5MpS8lh7xCAjA0gGq
 ebY8gh0ZAxMAQsGAFgG+wfnO4Z0ZGxLMuwv8vdw3CPyoshUjhVKDhDtEWjN+BoRAKcJX7r7zbB0bjkSUOwDQReqiCesMeYDgqohOSZGmxVStmRMOlpmpHL/2
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 58463
Cc: 58463 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Le Tue, Oct 18, 2022 at 02:09:57PM +0200, Liliana Marie Prikler a écrit :
> Hi Fulbert,


Hello Liliana and thank you for your remarks.

As it stands, it's only a proposal and I don't want to spend more
time on it unless I am sure Guix [doc] maintainers think it would
make a relevant addition to the Docbook.

Your remarks make sense to me, and I'd gladly improve it as
suggested, except for this : If by “structure” you mean Simon
Tournier presentation flow from REPL to script and finaly
extensions, then I will not be the right person to adapt it for the
Docbook, as I found the video *volumen* to follow a clean, logical
and clear path and to which the light addition of this
*codex+hypertext* transcript adds quick/random access and
searcheability. At present state (including the improvement you
suggested), it would be a good balance *for my taste* : easy access
with minimal discourse for maximal practical information.

Best regards.




Information forwarded to guix-patches@HIDDEN:
bug#58463; Package guix-patches. Full text available.

Message received at 58463 <at> debbugs.gnu.org:


Received: (at 58463) by debbugs.gnu.org; 18 Oct 2022 12:10:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 18 08:10:15 2022
Received: from localhost ([127.0.0.1]:51425 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oklQE-0008NS-BU
	for submit <at> debbugs.gnu.org; Tue, 18 Oct 2022 08:10:15 -0400
Received: from mailrelay.tugraz.at ([129.27.2.202]:10106)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <liliana.prikler@HIDDEN>) id 1oklQ4-0008Ms-1b
 for 58463 <at> debbugs.gnu.org; Tue, 18 Oct 2022 08:10:14 -0400
Received: from lprikler-laptop.ist.intra (gw.ist.tugraz.at [129.27.202.101])
 by mailrelay.tugraz.at (Postfix) with ESMTPSA id 4MsCNQ3WsHz3wdR;
 Tue, 18 Oct 2022 14:09:58 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at;
 s=mailrelay; t=1666094998;
 bh=FbWqvPV8/wdTNbFqcHxDcx4viQk+g8MBOU1YZ119m6E=;
 h=Subject:From:To:Date:In-Reply-To:References;
 b=MAwJbRCMu8qeK4GOAsGOc2jYDulndEMUyXE900NYJslosZeSh8fyol1Xzu0xXt4YZ
 quvQ9Fx5y3HHWrxalEAiKl5RMn+CEBzYuYLmlyddQiqyiW7YgUauujFEo85rDixUqG
 pmGHyJnbPMvz9K5gt/4+obMQMkDnhiPzaXR7Pfok=
Message-ID: <b8c5100dba3bfca99dda3b4ffebe570800d17cec.camel@HIDDEN>
Subject: Re: [PATCH] * doc: guix-cookbook: Add a "Guix API usage examples"
From: Liliana Marie Prikler <liliana.prikler@HIDDEN>
To: Fulbert <fulbert@HIDDEN>, 58463 <at> debbugs.gnu.org
Date: Tue, 18 Oct 2022 14:09:57 +0200
In-Reply-To: <Y0ZhE5Ut44s9VYb9@HIDDEN>
References: <Y0ZhE5Ut44s9VYb9@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
User-Agent: Evolution 3.46.0 
MIME-Version: 1.0
X-TUG-Backscatter-control: waObeELIUl4ypBWmcn/8wQ
X-Spam-Scanner: SpamAssassin 3.003001 
X-Spam-Score-relay: -0.4
X-Scanned-By: MIMEDefang 2.74 on 129.27.10.117
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 58463
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi Fulbert,

Am Mittwoch, dem 12.10.2022 um 08:39 +0200 schrieb Fulbert:

> * doc/guix-cookbook.texi ("Guix API usage examples"): New chapter.
>   Transcript of examples given in "Guix REPL - to infinity and
> beyond"
>   by Simon Tournier at the "10 years of Guix" event.
> ---
New chapter suffices.

>  doc/guix-cookbook.texi | 426
> +++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 426 insertions(+)
>=20
> diff --git a/doc/guix-cookbook.texi b/doc/guix-cookbook.texi
> index b61adc06da..8c6954b049 100644
> --- a/doc/guix-cookbook.texi
> +++ b/doc/guix-cookbook.texi
> @@ -73,6 +73,7 @@ Weblate} (@pxref{Translating Guix,,, guix, GNU Guix
> reference manual}).
>  * System Configuration::        Customizing the GNU System
>  * Advanced package management:: Power to the users!
>  * Environment management::      Control environment
> +* API usage examples::          Using the API via REPL, scripts and
> extensions.
> =20
>  * Acknowledgments::             Thanks!
>  * GNU Free Documentation License::  The license of this document.
> @@ -94,6 +95,11 @@ System Configuration
>  * Auto-Login to a Specific TTY:: Automatically Login a User to a
> Specific TTY
>  * Customizing the Kernel::       Creating and using a custom Linux
> kernel on Guix System.
> =20
> +API usage examples
> +
> +* API usage examples::          Using Guix through its API via REPL,
> script and extensions.
> +                                Transcript of Simon Tournier
> presentation : Guix REPL - to infinity and beyond
> +
>  @end detailmenu
>  @end menu
> =20
> @@ -2977,6 +2983,426 @@ will have predefined environment variables
> and procedures.
> =20
>  Run @command{direnv allow} to setup the environment for the first
> time.
> =20
> +@c
> *********************************************************************
> +@node API usage examples
> +@chapter API usage examples
> +
> +This chapter is a transcript of the examples given by Simon Tournier
> in
> +his presentation
> +@uref{
> https://10years.guix.gnu.org/video/guix-repl-to-infinity-and-beyond/,Guix
> +REPL - to infinity and beyond} (16 minutes video) at the
> +@uref{https://10years.guix.gnu.org/,10 years of Guix} event.
> +
> +Interactions with Guix as a library through its API via=E2=80=89 REPL,
> script
> +and ``guix extension'' (API subject to changes,
> +script/extension might break at any update@dots{}).
> +
> +Throuthout this chapter=E2=80=89:
Throughout this chapter, we'll be using the following abbreviations:

> +@itemize
> +@item
> +shell prompt=E2=80=89shortened to : @code{'$ '}
> +@item
> +guix REPL prompt shortened to : @code{'> '}
> +@end itemize
> +
> +@menu
> +* Guix REPL::
> +* Guix script::
> +* Guix extension::
> +@end menu
You want more descriptive names here.

> +@node Guix REPL
> +@section Guix REPL
> +@anchor{#guix-repl}
> +
> +@menu
> +* 101::
Maybe "Getting started"?
> +* select count packages on criteria::
> +* table count/group on criteria::
Pseudo-SQL doesn't make for great titles.
> +@end menu
> +
> +@node 101
> +@subsection 101
> +@anchor{#101}
> +@quotation Note
> +the REPL command @code{,use (module path name)} (shortened
> +@code{,u}) can be used as an equivalent for
> +@code{(use-modules (module path name))}. @code{,use} alone will list
> +currently imported modules.
> +@end quotation
I find it a little odd to lead with a note.
> +
> +Simple Guix REPL session
Full sentences
> +@example sh
> +$ guix repl
> +GNU Guile 3.0.8
> +;;  [skipped licence preamble]
> +> (use-modules (gnu packages base))
> +> findutils
> +$1 =3D #<package findutils@@4.8.0 gnu/packages/base.scm:294
> 7fc88588ddc0>
> +> ,use(guix)
> +> (package-name findutils)
> +$2 =3D "findutils"
> +> (package-version findutils)
> +$3 =3D "4.8.0"
> +> (package? findutils)
> +$4 =3D #t
> +@end example
> +
> +@quotation Note
> +the REPL command @code{,describe} (can be shortened @code{,d})=E2=80=89:
> +Usage: describe OBJ@*
> +Show description/documentation. (#f if unavailable)
> +@example sh
> +> ,d package->derivation
> +Return the <derivation> object of PACKAGE for SYSTEM.
> +> ,describe package-name
> +#f
> +@end example
> +@end quotation
> +
> +@quotation Note
> +when a module is imported, its exported objects are listed in
> +TAB-@dots{} completions.
I think you might be using notes a little too much.
> +
> +@example sh
> +> package-in<TAB>
> +package-input-error?          package-input-rewriting/spec
> +package-input-rewriting       package-inputs
> +@end example
> +@end quotation
> +
> +@node select count packages on criteria
> +@subsection select count packages on criteria
> +@anchor{#select-count-packages-on-criteria}
> +(=E2=86=92 4=E2=80=89min 20=E2=80=89s into Simon Tournier presentation)
I don't think it's useful to write out these timestamps in a way that
they're readable to the reader.  They might be fine as comments, but
I'd also suggest diverging from simon's structure to accomodate the
switch in media (and possibly target audience?)

> +In the following REPL session
> +
> +@itemize
> +@item
> +count of haskell packages and=E2=80=89;
> +
> +@item
> +count of haskell pacakges using the @code{#:cabal-revision} argument
> +@emph{(present in the package ghc-crypthohash-sha1, as shown below,
> for
> +instance)}
Full sentence
> +@lisp
> +(define-public ghc-cryptohash-sha1
> +  (package
> +  ;; skipped for clarity
> +    (build-system haskell-build-system)
> +    (arguments
> +     `(#:cabal-revision
> +       ("6" "10rpxrmqgwihmplczglwxf5q3l13z9j3kvi065z884y4dymmnkgc")
> +       ;; =E2=80=A6
> +@end lisp
> +
> +@end itemize
> +
> +REPL session=E2=80=89:
> +
> +@example sh
> +$ guix repl
> +GNU Guile 3.0.8
> +;;  [skipped licence preamble]
> +> (use-modules
> +  (guix)
> +  (guix build-system haskell)
> +  (gnu)
> +  (ice-9 match))
Even if it's just the REPL, indent properly.
> +>
> +> (define haskell-packages
> +  (fold-packages
> +    (lambda (package result)
> +      (if (eq? (package-build-system package) haskell-build-system)
> +         (cons package result)
> +         result))
> +    '()))
> +> (define (cabal-revision? package)
> +  (apply (lambda* (#:key cabal-revision #:allow-other-keys)
> +                  (match cabal-revision
> +                         ((revision hash) #t)
> +                         (_ #f)))
> +         (package-arguments package)))
> +> (define cabal-revision-packages
> +  (filter cabal-revision? haskell-packages))
> +> (length haskell-packages)
> +$1 =3D 721
> +> (length cabal-revision-packages)
> +$2 =3D 108
> +@end example
> +
> +@node table count/group on criteria
> +@subsection table count/group on criteria
> +@anchor{#table-countgroup-on-criteria}
> +(=E2=86=92 5=E2=80=89min 20=E2=80=89s into Simon Tournier presentation)
> +
> +The @code{arguments-vs-import.scm} file shown below demonstrate some
> +more sophisticated selection and grouping of packages, and can be
> passed
> +to @code{guix repl} like so=E2=80=89:
> +@example sh
> +$ guix repl -- arguments-vs-import.scm
> +@end example
> +Its interpretation will output a table similar to the one show below
> the
> +script-file content, giving the number of packages which ``tweak''
> their
> +arguments to the build and the number of packages which don't, all
> +grouped by build-system types.
> +
> +@code{arguments-vs-import.scm} file content=E2=80=89:
> +
> +@lisp
> +(use-modules (guix)
> +             (gnu)
> +             (ice-9 match))
> +
> +(define table (make-hash-table))
> +
> +(fold-packages (lambda (package result)
> +                 (let ((bs (build-system-name
> +                             (package-build-system package)))
> +                       (arg (package-arguments package)))
> +                   (match (hash-ref result bs)
> +                          ((tot wo wi)
> +                           (if (null? arg)
> +                             (hash-set! result bs (list
> +                                                    (1+ tot)
> +                                                    (1+ wo)
> +                                                    wi))
> +                             (hash-set! result bs (list
> +                                                    (1+ tot)
> +                                                    wo
> +                                                    (1+ wi)))))
> +                          (#f (if (null? arg)
> +                                (hash-set! result bs (list 1 1 0))
> +                                (hash-set! result bs (list 1 0 1))))
> +                          (_ (format #t "Error: ~s~%" (package-name
> package))))
> +                   result))
> +               table)
> +
> +(define fmt "~13s: ~4s =3D ~4s =3D ~4s + ~4s~%")
> +(format #t fmt
> +        'key 'tot 'tot 'no-arguments 'arguments)
> +(hash-for-each-handle (lambda (kv)
> +                       (match kv
> +                              ((key . value)
> +                               (match value
> +                                      ((tot wo wi)
> +                                       (format #t fmt
> +                                               key
> +                                               (+ wo wi)
> +                                               tot wo wi))))))
> +                     table)
> +@end lisp
> +
> +call from shell and output=E2=80=89:
> +
> +@example sh
> +$ cd ~/tmp/10-years-of-guix
> +$ guix repl -- guix-repl-and-beyond.scm
> +key          : tot  =3D tot  =3D no-arguments + arguments
> +ocaml        : 57   =3D 57   =3D 0    + 57
> +haskell      : 721  =3D 721  =3D 504  + 217
> +clojure      : 11   =3D 11   =3D 0    + 11
> +[skipping for clarity]
> +meson        : 442  =3D 442  =3D 89   + 353
> +texlive      : 143  =3D 143  =3D 0    + 143
> +python       : 2619 =3D 2619 =3D 797  + 1822
> +binary       : 14   =3D 14   =3D 0    + 14
> +@end example
> +
> +@node Guix script
> +@section Guix script
> +@anchor{#guix-script}
> +Simon Tournier does not say much about using guix through
> scripts@dots{}
> +probably because there is not much to say and the following links
> should
> +answer most questions.
> +
> +@itemize
> +@item
> +@uref{
> https://www.gnu.org/software/guile/manual/html_node/Running-Guile-Scripts=
.html#Running-Guile-Scripts,Running
> +Guile Scripts (Guile Reference Manual)}
> +@item
> +@uref{
> https://www.gnu.org/software/guile/manual/html_node/Guile-Scripting.html#=
Guile-Scripting,Guile
> +Scripting (Guile Reference Manual)}
> +@item
> +@uref{
> https://www.gnu.org/software/coreutils/manual/html_node/env-invocation.ht=
ml#env-invocation,env
> +invocation (GNU Coreutils 9.1)}
> +@end itemize
That's not a good way to lead into the section.  Also, you can use
simple refs to reference the manuals in question.

> +Nevertheless, the script ``@code{explore}'', from Ludovic Court=C3=A8s,
> used
> +in the next section to demonstrate a ``script-to-extension
> conversion'',
> +is probably an interesting example of using the guix API. See the
> links
> +below for more=E2=80=89:
> +
> +@itemize
> +@item
> +@uref{https://10years.guix.gnu.org/video/explore-your-system/,Ten
> Years
> +of Guix --- Explore your system --- Ludovic Court=C3=A8s}
> +@item
> +@uref{
> https://notabug.org/civodul/guix-explorer,civodul/guix-explorer:
> +Exploring Guix System. - NotABug.org: Free code hosting}
> +@end itemize
> +
> +@node Guix extension
> +@section Guix extension
> +@anchor{#guix-extension}
> +(=E2=86=92 7=E2=80=89min 05=E2=80=89s into Simon Tournier presentation)
> +
> +@menu
> +* minimal example::
> +* Ludovic Court=C3=A8s's explore.scm program::
> +@end menu
> +
> +@node minimal example
> +@subsection minimal example
> +@anchor{#minimal-example}
> +As a minimal example of a guix extension, the following file,
> +@code{~/tmp/10-years-of-guix/guix/extensions/hello.scm}, is used=E2=80=
=89:
> +
> +@lisp
> +(define-module (guix extensions hello)
> +               #:export (guix-hello))
> +
> +(define-command (guix-hello . cmd-line)
> +                (category plumbing)
> +                (synopsis "hello world")
> +                (display (G_ "hello folks!")))
> +@end lisp
> +
> +The environment variable @code{GUIX_EXTENSIONS_PATH} has to include
> the
> +path to the scrip file.
> +
> +With this in place, we can see the @code{hello} extension integrated
> in
> +the @code{guix} CLI, as the following capture shows, with the new
> +command ``hello'' added to the ``plumbing'' category=E2=80=89:
> +
> +@example sh
> +$ export GUIX_EXTENSIONS_PATH=3D"$HOME/tmp/10-years-of-
> guix/guix/extensions"
> +$ guix help
> +Usage: guix OPTION | COMMAND ARGS...
> +Run COMMAND with ARGS, if given.
> +# [skipping for clarity =E2=80=A6]=20
> +  plumbing commands
> +    archive    manipulate, export, and import normalized archives
> (nars)
> +    copy       copy store items remotely over SSH
> +    git        operate on Git repositories
> +    offload    set up and operate build offloading
> +    processes  list currently running sessions
> +    repl       read-eval-print loop (REPL) for interactive
> programming
> +    hello      hello world
> +
> +Report bugs to: bug-guix@@gnu.org.
> +# =E2=80=A6
> +@end example
> +
> +@node Ludovic Court=C3=A8s's explore.scm program
> +@subsection Ludovic Court=C3=A8s's explore.scm program
> +@anchor{#ludovic-court=C3=A8ss-explore.scm-program}
> +The @code{explore.scm} script can then be modified as follows to
> have it work
> +as a Guix extension rather than a script.
> +
> +(=E2=86=92 9=E2=80=89min 13=E2=80=89s into Simon Tournier presentation)
> +
> +@itemize
> +@item
> +removing the shebang call to guile
> +
> +@example
> +@verbatim
> +-#!/bin/sh
> +-exec "${GUILE:-guile}" -e "(@ (explore) guix-explore)" -s "$0" "$@"
> +-!#
> +@end verbatim
> +@end example
> +
> +@item
> +replacing the module declaration with appropriate path/name
> +@example
> +@verbatim
> +-(define-module (explore)
> ++(define-module (guix extensions explore)
> +@end verbatim
> +@end example
> +
> +@item
> +adding the module guix scripts to the use-module list
> +@example
> +@dots{}
> +@verbatim
> + #:use-module (guix ui)
> ++ #:use-module (guix scripts)
> + #:use-module (guix store)
> +@end verbatim
> +@dots{}
> +@end example
> +
> +@item
> +modifying the guix-explore definition
> +@example
> +@verbatim
> +-(define (guix-explore args)
> ++(define-command (guix-explore . args)
> ++ (category extension)
> ++ (synopsis ``explore your service'')
> +(define %user-module @dots{}
> +@end verbatim
> +@dots{}
> +@end example
> +@end itemize
> +
> +@quotation Note on the path to the script
I don't think that this series of diffs is a great idea.  Perhaps using
both copies and discussing the subtle differences between them might be
better?

> +[It seems that] to be used as a guix extension, Guix requires a
> script
> +to live under a
> +``[/@dots{}]/guix/extensions[/@dots{}]/<module-name>.scm'' tree
> +structure with the corresponding module declaration
> +@code{(define-module (guix extensions [@dots{}] <module-name>)
> @dots{}}.
Read the manual :)

> +This will work=E2=80=89:
> +
> +@example sh
> +$ pwd
> +~/tmp/10-years-of-guix/guix/extensions/test
> +$ head -1 hello.scm
> +(define-module (guix extensions test hello)
> +@end example
> +
> +@dots{} while this won't work=E2=80=89:
> +
> +@example sh
> +$ pwd
> +~/tmp/10-years-of-guix/guix/test
> +$ head -1 hello.scm
> +(define-module (guix test hello)
> +@end example
> +
> +@dots{} nor this=E2=80=89:
> +
> +@example sh
> +$ pwd
> +~/tmp/10-years-of-guix/nono/
> +$ head -1 hello.scm
> +(define-module (nono hello)
> +@end example
> +@end quotation
> +
> +lauching
rocket

> +@quotation Note
> +@code{explore} produces a visual and interactive representation of
> +the services used in a OS declaration. The user has to provide a
> path to
> +the OS configuration file to explore.
> +@end quotation
> +
> +All set, explore can now be used as a Guix extension like so=E2=80=89:
> +
> +@example sh
> +$ export GUIX_EXTENSIONS_PATH=3D/path/to/guix/extensions
> +$ guix explore -- /path/to/configure.scm
> +@end example
> +
Cheers
> =20




Information forwarded to guix-patches@HIDDEN:
bug#58463; Package guix-patches. Full text available.

Message received at 58463 <at> debbugs.gnu.org:


Received: (at 58463) by debbugs.gnu.org; 12 Oct 2022 06:39:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 12 02:39:27 2022
Received: from localhost ([127.0.0.1]:55447 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oiVOo-0005G2-3J
	for submit <at> debbugs.gnu.org; Wed, 12 Oct 2022 02:39:27 -0400
Received: from vimdzmsp-sfwd01.bluewin.ch ([195.186.120.131]:33557)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <fulbert@HIDDEN>) id 1oiVOl-0005Fk-9y
 for 58463 <at> debbugs.gnu.org; Wed, 12 Oct 2022 02:39:24 -0400
Received: from bluewin.ch ([213.55.244.21])
 by vimdzmsp-sfwd01.bluewin.ch Swisscom AG with ESMTPA
 id iVOdoyVSIaSptiVOeoudv2; Wed, 12 Oct 2022 08:39:17 +0200
X-Bluewin-Spam-Analysis: v=2.4 cv=XueZhXJ9 c=1 sm=1 tr=0 ts=63466115
 a=okETWHrkPlANAx00SlWV7w==:117 a=TlOf3hXxsTWzTsQR_ngA:9 a=QEXdDO2ut3YA:10
 a=mDV3o1hIAAAA:8 a=CcLUTRNvAAAA:8 a=ZeQmFzkMMxd-BLRRcvoA:9
 a=7Zwj6sZBwVKJAoWSPKxL6X1jA+E=:19 a=DzVYJPrVmD-3FXO4:21 a=ZQe0H2SEwV4A:10
 a=pxVx6LOZ-VoA:10 a=yavZe7-6PWEA:10 a=Vf4bL7R4lpsA:10 a=Esd8GEl26B8A:10
 a=7o4jWxSueEUA:10 a=_FVE-zBwftR9WsbkzFJk:22 a=obhdfE27RNN5ZnF-s2K5:22
X-Bluewin-Spam-Score: 0.00
X-FXIT-IP: IPv4[213.55.244.21] Epoch[1665556757]
X-Bluewin-AuthAs: fulbert@HIDDEN
Date: Wed, 12 Oct 2022 08:39:15 +0200
From: Fulbert <fulbert@HIDDEN>
To: 58463 <at> debbugs.gnu.org
Subject: [PATCH] * doc: guix-cookbook: Add a "Guix API usage examples"
Message-ID: <Y0ZhE5Ut44s9VYb9@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="SJkDfzcMafYJ1CHl"
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
X-CMAE-Envelope: MS4xfGmUVhcyTwyaZhD4CkfMlXmbwU3hCkVPc+lActDFPqBGwXdiViIVG2Ft6l65YHAxSEN7aS6LODM80tCbR1Mcc4BXqZ2Qr742DVOMqVh+5YlEUmptJZRF
 i4Eab9Ln2Y96Dgog8wYLDEnor3Nn9eX4ghVxZoGy3ADyzl9VwW003wrnCuIb34yC8/uxqcf3YqhAZA==
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 58463
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)


--SJkDfzcMafYJ1CHl
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline

Sorry, I forgot to attach the patch, so here it is.


--SJkDfzcMafYJ1CHl
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0001-doc-guix-cookbook-Add-a-Guix-API-usage-examples-chap.patch"
Content-Transfer-Encoding: 8bit

From c1af5a6ea0e56d0764969e118f0c55942db90e7b Mon Sep 17 00:00:00 2001
From: Fulbert <fulbert@HIDDEN>
Date: Wed, 12 Oct 2022 07:57:47 +0200
Subject: [PATCH] * doc: guix-cookbook: Add a "Guix API usage examples"
 chapter.

* doc/guix-cookbook.texi ("Guix API usage examples"): New chapter.
  Transcript of examples given in "Guix REPL - to infinity and beyond"
  by Simon Tournier at the "10 years of Guix" event.
---
 doc/guix-cookbook.texi | 426 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 426 insertions(+)

diff --git a/doc/guix-cookbook.texi b/doc/guix-cookbook.texi
index b61adc06da..8c6954b049 100644
--- a/doc/guix-cookbook.texi
+++ b/doc/guix-cookbook.texi
@@ -73,6 +73,7 @@ Weblate} (@pxref{Translating Guix,,, guix, GNU Guix reference manual}).
 * System Configuration::        Customizing the GNU System
 * Advanced package management:: Power to the users!
 * Environment management::      Control environment
+* API usage examples::          Using the API via REPL, scripts and extensions.
 
 * Acknowledgments::             Thanks!
 * GNU Free Documentation License::  The license of this document.
@@ -94,6 +95,11 @@ System Configuration
 * Auto-Login to a Specific TTY:: Automatically Login a User to a Specific TTY
 * Customizing the Kernel::       Creating and using a custom Linux kernel on Guix System.
 
+API usage examples
+
+* API usage examples::          Using Guix through its API via REPL, script and extensions.
+                                Transcript of Simon Tournier presentation : Guix REPL - to infinity and beyond
+
 @end detailmenu
 @end menu
 
@@ -2977,6 +2983,426 @@ will have predefined environment variables and procedures.
 
 Run @command{direnv allow} to setup the environment for the first time.
 
+@c *********************************************************************
+@node API usage examples
+@chapter API usage examples
+
+This chapter is a transcript of the examples given by Simon Tournier in
+his presentation
+@uref{https://10years.guix.gnu.org/video/guix-repl-to-infinity-and-beyond/,Guix
+REPL - to infinity and beyond} (16 minutes video) at the
+@uref{https://10years.guix.gnu.org/,10 years of Guix} event.
+
+Interactions with Guix as a library through its API via  REPL, script
+and ``guix extension'' (API subject to changes,
+script/extension might break at any update@dots{}).
+
+Throuthout this chapter :
+
+@itemize
+@item
+shell prompt shortened to : @code{'$ '}
+@item
+guix REPL prompt shortened to : @code{'> '}
+@end itemize
+
+@menu
+* Guix REPL::
+* Guix script::
+* Guix extension::
+@end menu
+
+@node Guix REPL
+@section Guix REPL
+@anchor{#guix-repl}
+
+@menu
+* 101::
+* select count packages on criteria::
+* table count/group on criteria::
+@end menu
+
+@node 101
+@subsection 101
+@anchor{#101}
+@quotation Note
+the REPL command @code{,use (module path name)} (shortened
+@code{,u}) can be used as an equivalent for
+@code{(use-modules (module path name))}. @code{,use} alone will list
+currently imported modules.
+@end quotation
+
+Simple Guix REPL session
+@example sh
+$ guix repl
+GNU Guile 3.0.8
+;;  [skipped licence preamble]
+> (use-modules (gnu packages base))
+> findutils
+$1 = #<package findutils@@4.8.0 gnu/packages/base.scm:294 7fc88588ddc0>
+> ,use(guix)
+> (package-name findutils)
+$2 = "findutils"
+> (package-version findutils)
+$3 = "4.8.0"
+> (package? findutils)
+$4 = #t
+@end example
+
+@quotation Note
+the REPL command @code{,describe} (can be shortened @code{,d}) :
+Usage: describe OBJ@*
+Show description/documentation. (#f if unavailable)
+@example sh
+> ,d package->derivation
+Return the <derivation> object of PACKAGE for SYSTEM.
+> ,describe package-name
+#f
+@end example
+@end quotation
+
+@quotation Note
+when a module is imported, its exported objects are listed in
+TAB-@dots{} completions.
+
+@example sh
+> package-in<TAB>
+package-input-error?          package-input-rewriting/spec
+package-input-rewriting       package-inputs
+@end example
+@end quotation
+
+@node select count packages on criteria
+@subsection select count packages on criteria
+@anchor{#select-count-packages-on-criteria}
+(→ 4 min 20 s into Simon Tournier presentation)
+
+In the following REPL session
+
+@itemize
+@item
+count of haskell packages and ;
+
+@item
+count of haskell pacakges using the @code{#:cabal-revision} argument
+@emph{(present in the package ghc-crypthohash-sha1, as shown below, for
+instance)}
+
+@lisp
+(define-public ghc-cryptohash-sha1
+  (package
+  ;; skipped for clarity
+    (build-system haskell-build-system)
+    (arguments
+     `(#:cabal-revision
+       ("6" "10rpxrmqgwihmplczglwxf5q3l13z9j3kvi065z884y4dymmnkgc")
+       ;; …
+@end lisp
+
+@end itemize
+
+REPL session :
+
+@example sh
+$ guix repl
+GNU Guile 3.0.8
+;;  [skipped licence preamble]
+> (use-modules
+  (guix)
+  (guix build-system haskell)
+  (gnu)
+  (ice-9 match))
+>
+> (define haskell-packages
+  (fold-packages
+    (lambda (package result)
+      (if (eq? (package-build-system package) haskell-build-system)
+         (cons package result)
+         result))
+    '()))
+> (define (cabal-revision? package)
+  (apply (lambda* (#:key cabal-revision #:allow-other-keys)
+                  (match cabal-revision
+                         ((revision hash) #t)
+                         (_ #f)))
+         (package-arguments package)))
+> (define cabal-revision-packages
+  (filter cabal-revision? haskell-packages))
+> (length haskell-packages)
+$1 = 721
+> (length cabal-revision-packages)
+$2 = 108
+@end example
+
+@node table count/group on criteria
+@subsection table count/group on criteria
+@anchor{#table-countgroup-on-criteria}
+(→ 5 min 20 s into Simon Tournier presentation)
+
+The @code{arguments-vs-import.scm} file shown below demonstrate some
+more sophisticated selection and grouping of packages, and can be passed
+to @code{guix repl} like so :
+@example sh
+$ guix repl -- arguments-vs-import.scm
+@end example
+Its interpretation will output a table similar to the one show below the
+script-file content, giving the number of packages which ``tweak'' their
+arguments to the build and the number of packages which don't, all
+grouped by build-system types.
+
+@code{arguments-vs-import.scm} file content :
+
+@lisp
+(use-modules (guix)
+             (gnu)
+             (ice-9 match))
+
+(define table (make-hash-table))
+
+(fold-packages (lambda (package result)
+                 (let ((bs (build-system-name
+                             (package-build-system package)))
+                       (arg (package-arguments package)))
+                   (match (hash-ref result bs)
+                          ((tot wo wi)
+                           (if (null? arg)
+                             (hash-set! result bs (list
+                                                    (1+ tot)
+                                                    (1+ wo)
+                                                    wi))
+                             (hash-set! result bs (list
+                                                    (1+ tot)
+                                                    wo
+                                                    (1+ wi)))))
+                          (#f (if (null? arg)
+                                (hash-set! result bs (list 1 1 0))
+                                (hash-set! result bs (list 1 0 1))))
+                          (_ (format #t "Error: ~s~%" (package-name package))))
+                   result))
+               table)
+
+(define fmt "~13s: ~4s = ~4s = ~4s + ~4s~%")
+(format #t fmt
+        'key 'tot 'tot 'no-arguments 'arguments)
+(hash-for-each-handle (lambda (kv)
+                       (match kv
+                              ((key . value)
+                               (match value
+                                      ((tot wo wi)
+                                       (format #t fmt
+                                               key
+                                               (+ wo wi)
+                                               tot wo wi))))))
+                     table)
+@end lisp
+
+call from shell and output :
+
+@example sh
+$ cd ~/tmp/10-years-of-guix
+$ guix repl -- guix-repl-and-beyond.scm
+key          : tot  = tot  = no-arguments + arguments
+ocaml        : 57   = 57   = 0    + 57
+haskell      : 721  = 721  = 504  + 217
+clojure      : 11   = 11   = 0    + 11
+[skipping for clarity]
+meson        : 442  = 442  = 89   + 353
+texlive      : 143  = 143  = 0    + 143
+python       : 2619 = 2619 = 797  + 1822
+binary       : 14   = 14   = 0    + 14
+@end example
+
+@node Guix script
+@section Guix script
+@anchor{#guix-script}
+Simon Tournier does not say much about using guix through scripts@dots{}
+probably because there is not much to say and the following links should
+answer most questions.
+
+@itemize
+@item
+@uref{https://www.gnu.org/software/guile/manual/html_node/Running-Guile-Scripts.html#Running-Guile-Scripts,Running
+Guile Scripts (Guile Reference Manual)}
+@item
+@uref{https://www.gnu.org/software/guile/manual/html_node/Guile-Scripting.html#Guile-Scripting,Guile
+Scripting (Guile Reference Manual)}
+@item
+@uref{https://www.gnu.org/software/coreutils/manual/html_node/env-invocation.html#env-invocation,env
+invocation (GNU Coreutils 9.1)}
+@end itemize
+
+Nevertheless, the script ``@code{explore}'', from Ludovic Courtès, used
+in the next section to demonstrate a ``script-to-extension conversion'',
+is probably an interesting example of using the guix API. See the links
+below for more :
+
+@itemize
+@item
+@uref{https://10years.guix.gnu.org/video/explore-your-system/,Ten Years
+of Guix --- Explore your system --- Ludovic Courtès}
+@item
+@uref{https://notabug.org/civodul/guix-explorer,civodul/guix-explorer:
+Exploring Guix System. - NotABug.org: Free code hosting}
+@end itemize
+
+@node Guix extension
+@section Guix extension
+@anchor{#guix-extension}
+(→ 7 min 05 s into Simon Tournier presentation)
+
+@menu
+* minimal example::
+* Ludovic Courtès's explore.scm program::
+@end menu
+
+@node minimal example
+@subsection minimal example
+@anchor{#minimal-example}
+As a minimal example of a guix extension, the following file,
+@code{~/tmp/10-years-of-guix/guix/extensions/hello.scm}, is used :
+
+@lisp
+(define-module (guix extensions hello)
+               #:export (guix-hello))
+
+(define-command (guix-hello . cmd-line)
+                (category plumbing)
+                (synopsis "hello world")
+                (display (G_ "hello folks!")))
+@end lisp
+
+The environment variable @code{GUIX_EXTENSIONS_PATH} has to include the
+path to the scrip file.
+
+With this in place, we can see the @code{hello} extension integrated in
+the @code{guix} CLI, as the following capture shows, with the new
+command ``hello'' added to the ``plumbing'' category :
+
+@example sh
+$ export GUIX_EXTENSIONS_PATH="$HOME/tmp/10-years-of-guix/guix/extensions"
+$ guix help
+Usage: guix OPTION | COMMAND ARGS...
+Run COMMAND with ARGS, if given.
+# [skipping for clarity …] 
+  plumbing commands
+    archive    manipulate, export, and import normalized archives (nars)
+    copy       copy store items remotely over SSH
+    git        operate on Git repositories
+    offload    set up and operate build offloading
+    processes  list currently running sessions
+    repl       read-eval-print loop (REPL) for interactive programming
+    hello      hello world
+
+Report bugs to: bug-guix@@gnu.org.
+# …
+@end example
+
+@node Ludovic Courtès's explore.scm program
+@subsection Ludovic Courtès's explore.scm program
+@anchor{#ludovic-courtèss-explore.scm-program}
+The @code{explore.scm} script can then be modified as follows to have it work
+as a Guix extension rather than a script.
+
+(→ 9 min 13 s into Simon Tournier presentation)
+
+@itemize
+@item
+removing the shebang call to guile
+
+@example
+@verbatim
+-#!/bin/sh
+-exec "${GUILE:-guile}" -e "(@ (explore) guix-explore)" -s "$0" "$@"
+-!#
+@end verbatim
+@end example
+
+@item
+replacing the module declaration with appropriate path/name
+@example
+@verbatim
+-(define-module (explore)
++(define-module (guix extensions explore)
+@end verbatim
+@end example
+
+@item
+adding the module guix scripts to the use-module list
+@example
+@dots{}
+@verbatim
+ #:use-module (guix ui)
++ #:use-module (guix scripts)
+ #:use-module (guix store)
+@end verbatim
+@dots{}
+@end example
+
+@item
+modifying the guix-explore definition
+@example
+@verbatim
+-(define (guix-explore args)
++(define-command (guix-explore . args)
++ (category extension)
++ (synopsis ``explore your service'')
+(define %user-module @dots{}
+@end verbatim
+@dots{}
+@end example
+@end itemize
+
+@quotation Note on the path to the script
+
+[It seems that] to be used as a guix extension, Guix requires a script
+to live under a
+``[/@dots{}]/guix/extensions[/@dots{}]/<module-name>.scm'' tree
+structure with the corresponding module declaration
+@code{(define-module (guix extensions [@dots{}] <module-name>) @dots{}}.
+
+This will work :
+
+@example sh
+$ pwd
+~/tmp/10-years-of-guix/guix/extensions/test
+$ head -1 hello.scm
+(define-module (guix extensions test hello)
+@end example
+
+@dots{} while this won't work :
+
+@example sh
+$ pwd
+~/tmp/10-years-of-guix/guix/test
+$ head -1 hello.scm
+(define-module (guix test hello)
+@end example
+
+@dots{} nor this :
+
+@example sh
+$ pwd
+~/tmp/10-years-of-guix/nono/
+$ head -1 hello.scm
+(define-module (nono hello)
+@end example
+@end quotation
+
+lauching
+
+@quotation Note
+@code{explore} produces a visual and interactive representation of
+the services used in a OS declaration. The user has to provide a path to
+the OS configuration file to explore.
+@end quotation
+
+All set, explore can now be used as a Guix extension like so :
+
+@example sh
+$ export GUIX_EXTENSIONS_PATH=/path/to/guix/extensions
+$ guix explore -- /path/to/configure.scm
+@end example
+
 @c *********************************************************************
 @node Acknowledgments
 @chapter Acknowledgments
-- 
2.38.0


--SJkDfzcMafYJ1CHl--




Information forwarded to guix-patches@HIDDEN:
bug#58463; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 12 Oct 2022 06:36:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 12 02:36:34 2022
Received: from localhost ([127.0.0.1]:55437 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oiVM2-0005B2-BJ
	for submit <at> debbugs.gnu.org; Wed, 12 Oct 2022 02:36:34 -0400
Received: from lists.gnu.org ([209.51.188.17]:42850)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <fulbert@HIDDEN>) id 1oiVM0-0005Au-Oh
 for submit <at> debbugs.gnu.org; Wed, 12 Oct 2022 02:36:33 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:34220)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <fulbert@HIDDEN>)
 id 1oiVLy-0006tv-5n
 for guix-patches@HIDDEN; Wed, 12 Oct 2022 02:36:31 -0400
Received: from vimdzmsp-sfwd03.bluewin.ch ([195.186.120.132]:42838)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <fulbert@HIDDEN>)
 id 1oiVLv-0003Ow-Fs
 for guix-patches@HIDDEN; Wed, 12 Oct 2022 02:36:29 -0400
Received: from bluewin.ch ([213.55.244.21])
 by vimdzmsp-sfwd03.bluewin.ch Swisscom AG with ESMTPA
 id iVLno2Orm9bwZiVLoozCdu; Wed, 12 Oct 2022 08:36:20 +0200
X-Bluewin-Spam-Analysis: v=2.4 cv=G4Z/r/o5 c=1 sm=1 tr=0 ts=63466064
 a=okETWHrkPlANAx00SlWV7w==:117 a=IkcTkHD0fZMA:10 a=3OytrVyeAAAA:8
 a=UyxTCtqkecVoeLEv8gEA:9 a=QEXdDO2ut3YA:10 a=R46MPgWzj8cwk1o-Nt-Q:22
X-Bluewin-Spam-Score: 0.00
X-FXIT-IP: IPv4[213.55.244.21] Epoch[1665556580]
X-Bluewin-AuthAs: fulbert@HIDDEN
Date: Wed, 12 Oct 2022 08:36:19 +0200
From: Fulbert <fulbert@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH] * doc: guix-cookbook: Add a "Guix API usage examples"
Message-ID: <Y0ZgY7ifJg0vkZxB@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
X-CMAE-Envelope: MS4xfCZTSW8DNTw1v/pR++OsSdRT6waxNbaSK3t+EAecYL8M2V1oebyakrs+Sdd+/pN7kIQwaN4Or5kGkp2dZAc60k/qmpXSeBL8aWG64wfKMbIhD7Eewhdm
 6Adxix0QG/zOhSgn3FboG9nxppMIWynmJ/hWGIJowBOtZVf6bn+PKiWKRqEGLPORDxbiBUH8wfVT1g==
Received-SPF: pass client-ip=195.186.120.132; envelope-from=fulbert@HIDDEN;
 helo=vimdzmsp-sfwd03.bluewin.ch
X-Spam_score_int: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.4 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.6 (/)

Hello,

Attached I propose a patch with an additional chapter to the
guix-cookbook. It is a transcript of Simon Tournier examples used in
his "Guix REPL - to infinity and beyond" presentation at the
10 years of Guix event.

I made the resulting html available at the following address, so
the interested parties can quickly preview it.

https://fulbert.neocities.org/guix/10-years-of-guix/simon-tournier-guix-repl/guix-cookbook/index.html

Best regards,
Fulbert




Acknowledgement sent to Fulbert <fulbert@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#58463; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 3 Nov 2022 16:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.