On how Nix led me to Guix about 2.5 years in

Intro

About 4 years ago (huh time flies!) I have found Nix and NixOS (Nix and NixOS) and I thought "yup this is it I'm sold for it ... if I manage to understand and use the Nix language".

Turns out I didn't really grok the Nix language 😄🤷

Nix - the Haskell-ish

Nix is a functional language dsl ... uhm similar to Haskell according to it's developers, I wouldn't know never tryed Haskell.

Here is the (quite enthusiastic!) post I did in 2020 about it, if you want a look here

The hard wall I've hit with Nix was trying to write my own packages and services which is pretty much unavoidable when using a declarative distro like NixOS, if something isn't already there you're in for a rough time.

NixOS Firehol is one of the things I did work on and while it does work, I think my hairs are whiter than before. It took a huge amount of effort and debugging to get it to the state it is in and I still wasn't able to get it to do everything I planned to, because I just can't get Nix to behave 😧

The Nix community is absolutely great (leaving the recent events out of it you can read more about that over the nets), and usually you would find a solution to your issue in the forums, but I've realized that as long as I'm not able to understand the Nix language there is no point in continuing to use it.

So one day someone posted on the forums about Nix's brother Guix and I thought hey let's have a look.

Guix - ((((...lots of lispy parens...))))

OK we kinda know what Nix is, but what is Guix?

From Guix GNU site:

"GNU Guix is a package management tool for and distribution of the GNU system. Guix makes it easy for unprivileged users to install, upgrade, or remove software packages, to roll back to a previous package set, to build packages from source, and generally assists with the creation and maintenance of software environments."

Right 😄. Actually the distribution based on Guix is called GuixSD to differenciate the OS from the package manager.

TL;DR: Guix is a reimplementation of Nix by the GNU people which uses GNU Guile as the language instead of Nix. It originally used(still uses?) the nix-daemon to manage derivations in the same format as Nix does.

GNU Guile is an implemetation of the Scheme programming language, which in turn is a functional programming language lisp dialect?.

It looks like this:

;;; Hello world program
(define name "World")
(display (string-append "Hello " name "!"))
(newline)

Now that we have defined what Guix is let's add some more GuixSD info.

GuixSD is a GNU Linux distribution using Guix as a package manager as NixOS is to Nix. Being GNU though it does not employ SystemD as an init system it uses GNU Herd which is also written in Guile, which makes it great for the declarative configuration which is also Guile.

Life with GNU, Guile, Guix and GuixSD

I would suggest a VM for the first contact as it will make things a lot easyer to get started.

Before diving into Guix you should be aware of a few things, It's not a rant just some facts:

  • Guix is following the GNU libre philosophy of free software which means everything non free is stripped out of the Linux kernel including closed source firmware and drivers, so the chances to get it working on the usual hardware are close to nil
  • the system installer is not very newbie friendly, while it does have a text based gui and it usually works beware there might be trouble especially on systems sporting closed source firmware devices
  • you got to get comfty with Guile because all the configuration is done using Guile
  • there are no official forums, all communication is done trough mailing lists
  • there are irc and matrix channels for chat and there it is probably the best to ask questions
  • contributing back is complicated, it's a mail based process, which is probably a reason for people to shy away from doing it

Compared to the Nix world I find the communication through mailing lists a bit awkward, contributing and maintaining packages upstream is not straight forward.

Warnings aside, here are the nice things (once you get the hang of it):

  • I find packaging software for Guix is a lot simpler than for Nix, the Guix people did a great job handling build systems and Guile is a good choice for programming
  • same goes for services or daemons, it is fairly easy to write a new sevice or adapt an existing one
  • you can create your own channel for your packages and services
  • as with Nix you can create your own dev environments
  • you can manage the dotfiles using guix
  • you can easily create user services which run at login

For the closed source firmware challenged among us the great guys at Nonguix have you covered, providing pacakges for the Linux kernel, firmware, drivers and other closed source useful software.

A great resource is also Systemcrafters.net with lots of guides and a forum! Also a nice tool is Toys whereis which indexes custom Guix channels.

And finally this is my channel Github where I've packaged some useful things and services.

End