Re: [PATCH guix-artwork v4] website: posts: Add Dissecting Guix, Part 1: Derivations.

2023-01-11 Thread zimoun
Hi,

On Tue, 10 Jan 2023 at 06:59, "("  wrote:

> Probably, yeah.  It might take me longer to write the monads post, since i 
> didn't
> understand Guix's monads when I started :) (I do understand them a bit now, 
> though.)

Feel free to post to guix-b...@gnu.org even an early draft if you want
some early feedback.  Well, if this private alias is still working. :-)

(Hum, I do not remember who is behind in addition to me. ;-)))

Cheers,
simon



Re: [PATCH guix-artwork v4] website: posts: Add Dissecting Guix, Part 1: Derivations.

2023-01-09 Thread (
On Mon Jan 9, 2023 at 11:13 AM GMT, Ludovic Courtès wrote:
> Yay!  That can even be parts 2 and 3.  :-)

Probably, yeah.  It might take me longer to write the monads post, since i 
didn't
understand Guix's monads when I started :) (I do understand them a bit now, 
though.)

-- (


signature.asc
Description: PGP signature


Re: [PATCH guix-artwork v4] website: posts: Add Dissecting Guix, Part 1: Derivations.

2023-01-09 Thread Ludovic Courtès
"("  skribis:

> On Wed Jan 4, 2023 at 12:00 PM GMT, Ludovic Courtès wrote:
>> Finally pushed!  It should show up online soon.  Looking forward to
>> part 2.  :-)
>
> \o/
>
> Next part will be about monads and G-expressions :)

Yay!  That can even be parts 2 and 3.  :-)

Ludo’.



Re: [PATCH guix-artwork v4] website: posts: Add Dissecting Guix, Part 1: Derivations.

2023-01-05 Thread 宋文武
"("  writes:

> On Wed Jan 4, 2023 at 12:00 PM GMT, Ludovic Courtès wrote:
>> Finally pushed!  It should show up online soon.  Looking forward to
>> part 2.  :-)
>
> \o/
>
> Next part will be about monads and G-expressions :)
>

Great, I enjoy read Part 1, and waiting for next...  Thank you!



Re: [PATCH guix-artwork v4] website: posts: Add Dissecting Guix, Part 1: Derivations.

2023-01-05 Thread (
On Wed Jan 4, 2023 at 12:00 PM GMT, Ludovic Courtès wrote:
> Finally pushed!  It should show up online soon.  Looking forward to
> part 2.  :-)

\o/

Next part will be about monads and G-expressions :)

-- (


signature.asc
Description: PGP signature


Re: [PATCH guix-artwork v4] website: posts: Add Dissecting Guix, Part 1: Derivations.

2023-01-04 Thread Ludovic Courtès
Heya (,

"("  skribis:

> * website/posts/dissecting-guix-1-derivations.md: New blog post.

Finally pushed!  It should show up online soon.  Looking forward to
part 2.  :-)

> +`guix repl` provides the `,lower` command to create derivations quickly:
> +
> +```scheme
> +,lower irssi
> +(pk $1) ;use the $N variable automatically bound by the REPL
> +;;; (# /gnu/store/drjfddvlblpr635jazrg9kn5azd9hsbj-irssi-1.4.3.drv => 
> /gnu/store/v5pd69j3hjs1fck4b5p9hd91wc8yf5qx-irssi-1.4.3 7f3bff4a6370>)
> +```

I took the liberty to turn this into a sample session to give a better
idea of what people would type and see at their REPL.

Thanks,
Ludo’.



[PATCH guix-artwork v4] website: posts: Add Dissecting Guix, Part 1: Derivations.

2022-12-17 Thread (
* website/posts/dissecting-guix-1-derivations.md: New blog post.
---
Heya,

Here, I've addressed Ludo's criticisms.

I do still think we should use LOWER-OBJECT rather than ,LOWER most of the time,
but there is now a paragraph noting that it exists.

 .../posts/dissecting-guix-1-derivations.md| 450 ++
 1 file changed, 450 insertions(+)
 create mode 100644 website/posts/dissecting-guix-1-derivations.md

diff --git a/website/posts/dissecting-guix-1-derivations.md 
b/website/posts/dissecting-guix-1-derivations.md
new file mode 100644
index 000..7226029
--- /dev/null
+++ b/website/posts/dissecting-guix-1-derivations.md
@@ -0,0 +1,450 @@
+title: Dissecting Guix, Part 1: Derivations
+date: TBC
+author: (
+tags: Dissecting Guix, Functional package management, Programming interfaces, 
Scheme API
+---
+To a new user, Guix's functional architecture can seem quite alien, and 
possibly
+offputting.  With a combination of extensive `#guix`-querying, determined
+manual-reading, and plenty of source-perusing, they may eventually figure out
+how everything fits together by themselves, but this can be frustrating and
+often takes a fairly long time.
+
+However, once you peel back the layers, the "Nix way" is actually rather
+elegant, if perhaps not as simple as the mutable, imperative style implemented
+by the likes of [`dpkg`](https://wiki.debian.org/dpkg) and
+[`pacman`](https://wiki.archlinux.org/title/pacman).
+This series of blog posts will cover basic Guix concepts, taking a "ground-up"
+approach by dealing with lower-level concepts first, and hopefully make those
+months of information-gathering unnecessary.
+
+Before we dig in to Guix-specific concepts, we'll need to learn about one
+inherited from [Nix](https://nixos.org), the original functional package 
manager
+and the inspiration for Guix; the idea of a
+[_derivation_](https://guix.gnu.org/manual/devel/en/html_node/Derivations.html)
+and its corresponding _store items_.
+
+These concepts were originally described by Eelco Dolstra, the original author
+of Nix, in their [PhD thesis](https://edolstra.github.io/pubs/phd-thesis.pdf);
+see _§ 2.1 The Nix store_ and _§ 2.4 Store Derivations_.
+
+# Store Items
+
+As you probably know, everything that Guix builds is stored in the _store_,
+which is almost always the `/gnu/store` directory.  It's the job of the
+[`guix-daemon`](https://guix.gnu.org/manual/en/html_node/Invoking-guix_002ddaemon.html)
+to manage the store and build things.  If you run
+[`guix build 
PKG`](https://guix.gnu.org/manual/en/html_node/Invoking-guix-build.html),
+`PKG` will be built or downloaded from a substitute server if available, and a
+path to an item in the store will be displayed.
+
+```
+$ guix build irssi
+/gnu/store/v5pd69j3hjs1fck4b5p9hd91wc8yf5qx-irssi-1.4.3
+```
+
+This item contains the final result of building [`irssi`](https://irssi.org).
+Let's peek inside:
+
+```
+$ ls $(guix build irssi)
+bin/  etc/  include/  lib/  share/
+$ ls $(guix build irssi)/bin
+irssi*
+```
+
+`irssi` is quite a simple package.  What about a more complex one, like
+[`glib`](https://docs.gtk.org/glib)?
+
+```
+$ guix build glib
+/gnu/store/bx8qq76idlmjrlqf1faslsq6zjc6f426-glib-2.73.3-bin
+/gnu/store/j65bhqwr7qq7l77nj0ahmk1f1ilnjr3a-glib-2.73.3-debug
+/gnu/store/3pn4ll6qakgfvfpc4mw89qrrbsgj3jf3-glib-2.73.3-doc
+/gnu/store/dvsk6x7d26nmwsqhnzws4iirb6dhhr1d-glib-2.73.3
+/gnu/store/4c8ycz501n2d0xdi4blahvnbjhd5hpa8-glib-2.73.3-static
+```
+
+`glib` produces five `/gnu/store` items, because it's possible for a package to
+produce multiple 
[outputs](https://guix.gnu.org/manual/en/html_node/Packages-with-Multiple-Outputs.html).
+Each output can be referred to separately, by prefixing a package's name with
+`:OUTPUT` where supported.  For example, this
+[`guix 
install`](https://guix.gnu.org/manual/en/html_node/Invoking-guix-package.html)
+invocation will add `glib`'s `bin` output to your profile:
+
+```
+$ guix install glib:bin
+```
+
+The default output is `out`, so when you pass `glib` by itself to that command,
+it will actually install `glib:out` to the profile.
+
+`guix build` also provides the `--source` flag, which produces the store item
+corresponding to the given package's downloaded source code.
+
+```
+$ guix build --source irssi
+/gnu/store/cflbi4nbak0v9xbyc43lamzl4a539hhb-irssi-1.4.3.tar.xz
+$ guix build --source glib
+/gnu/store/d22wzjq3xm3q8hwnhbgk2xd3ph7lb6ay-glib-2.73.3.tar.xz
+```
+
+But how does Guix know how to build these store outputs in the first place?
+That's where derivations come in.
+
+# `.drv` Files
+
+You've probably seen these being printed by the Guix program now and again.
+Derivations, represented in the daemon's eyes by `.drv` files, contain
+instructions for building store items.  We can retrieve the paths of these
+`.drv` files with the `guix build --derivations` command:
+
+```
+$ guix build --derivations irssi
+/gnu/store/zcgmhac8r4kdj2s6bcvcmhh4k35qvihx-irssi-1.4.3.drv
+```
+
+`guix build` can act