<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title>frankie-tales</title><id>https://lovergine.com/feeds/tags/guix.xml</id><subtitle>Tag: guix</subtitle><updated>2026-05-13T00:00:02Z</updated><link href="https://lovergine.com/feeds/tags/guix.xml" rel="self" /><link href="https://lovergine.com" /><entry><title>Creating your own Guix substitute server</title><id>https://lovergine.com/creating-your-own-guix-substitute-server.html</id><author><name>Francesco P. Lovergine</name><email>mbox@lovergine.com</email></author><updated>2025-12-21T16:30:00Z</updated><link href="https://lovergine.com/creating-your-own-guix-substitute-server.html" rel="alternate" /><content type="html">&lt;p&gt;I lately dedicated some time to setting up my own substitute server for Guix on
a foreign distribution. This post is about that experience, after verifying
that such a process is currently quite underdocumented. A substitute server is
clearly a required step in order to cultivate a personal or
unofficial/alternative channel for Guix, at least if one has more than one box
(and possibly one physical location) to manage.&lt;/p&gt;&lt;p&gt;&lt;img src=&quot;/images/substs-srv.png&quot; alt=&quot;Sbstitutes server welcome&quot; /&gt;&lt;/p&gt;&lt;p&gt;For people not up to date with the news from these digital bits, in the last
year or so, I elected the Guix package manager and system as my second-preferred
OS, after Debian GNU/Linux. I published more posts about it, all readable under
my &lt;a href=&quot;/tags/guix.html&quot;&gt;dedicated feed&lt;/a&gt;.&lt;/p&gt;&lt;h2 id=&quot;what-is-a-substitute-server&quot;&gt;What is a Substitute Server?&lt;/h2&gt;&lt;p&gt;Guix is mainly a source-level roll-on distribution, so at every pull, there is a
concrete risk of having to build your own binaries if no binary provider is
available to speed up your update process. That is a certainty if you play with
your own packages. This is the concrete reason to possibly have a substitute
server in the LAN, even though the official ones can be subject to problems and
DDoS.
Specifically, I set up a substitute server based on Debian GNU/Linux reachable
both at home and at work. While the Guix manual is currently quite verbose about
how to use a substitute server from a client, it is bit incomplete about the
server side.&lt;/p&gt;&lt;h2 id=&quot;installation-of-guix-on-debian&quot;&gt;Installation of Guix on Debian&lt;/h2&gt;&lt;p&gt;The very first step is to install the Guix package manager on Debian, which is
currently not more possible using a Debian package from the main archive, as in
the past (see &lt;a href=&quot;https://lwn.net/Articles/1035491/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;this LWN post about&lt;/a&gt;).
Currently, a binary provided by the Guix project has to be used for that. It is
quite straightforward if you use the installer script provided with some
caution.&lt;/p&gt;&lt;p&gt;For instance, to install the current Guix version, it is possible to run:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;$ wget -O /tmp/guix-binary.tar.xz \
    https://ci.guix.gnu.org/search/latest/archive?query=spec:tarball+status:success+system:x86_64-linux+guix-binary.tar.xz
$ wget -O /tmp/guix-install.sh https://guix.gnu.org/install.sh

# do your homework to check and verify binary and script, then...
$ sudo -i

# export GUIX_BINARY_FILE_NAME=/tmp/guix-binary.tar.xz
# chmod a+x /tmp/guix-install.sh
# apt install uidmap gnupg
# /tmp/guix-install.sh
# rm -f /tmp/guix-install.sh /tmp/guix-binary.tar.xz
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;That will install a daemon for building sources under an unprivileged
&lt;code&gt;guix-daemon&lt;/code&gt; user, which has full control over the guix data store at
&lt;code&gt;/gnu/store&lt;/code&gt;.&lt;/p&gt;&lt;h2 id=&quot;daemon-configuration-and-storage&quot;&gt;Daemon configuration and storage&lt;/h2&gt;&lt;p&gt;Such a daemon is run under &lt;code&gt;systemd&lt;/code&gt; control with a specific unit file. First, the
Guix data store needs plenty of disk space and inodes; I suggest moving the
&lt;code&gt;/gnu/store&lt;/code&gt; tree under an XFS or even a BTRFS filesystem, for that.&lt;/p&gt;&lt;p&gt;Second, the current installer tries to mount &lt;code&gt;/gnu/store&lt;/code&gt; in read-only mode,
which can prevent running the &lt;code&gt;guix&lt;/code&gt; command as an unprivileged user on foreign
distros. This can be disabled if problems occur, as could happen under specific conditions.
Once the &lt;code&gt;guix-daemon&lt;/code&gt; service
is stopped, the &lt;code&gt;gnu-store.mount&lt;/code&gt; can be disabled by ensuring the &lt;code&gt;/gnu/store&lt;/code&gt;
directory is correctly assigned to the &lt;code&gt;guix-daemon&lt;/code&gt; user:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;$ ls -ld /gnu/store/
drwxrwxr-t 584 guix-daemon guix-daemon 12M 18 dic 07.31 /gnu/store/
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&quot;the-systemd-unit-file-for-the-guix-daemon&quot;&gt;The systemd unit file for the Guix daemon&lt;/h3&gt;&lt;p&gt;This is the proposed unit file for the &lt;code&gt;guix-daemon&lt;/code&gt; process:&lt;/p&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot;&gt;[Unit]
Description=Build daemon for GNU Guix
# Start before 'gnu-store.mount' to get a writable view of the store.
Before=gnu-store.mount

[Service]
ExecStart=/var/guix/profiles/per-user/root/current-guix/bin/guix-daemon \
  --discover=yes \
  --substitute-urls='https://bordeaux.guix.gnu.org https://ci.guix.gnu.org'
Environment='GUIX_STATE_DIRECTORY=/var/guix' 'GUIX_LOCPATH=/var/guix/profiles/per-user/root/guix-profile/lib/locale' LC_ALL=en_US.utf8
# Run under a dedicated unprivileged user account.
User=guix-daemon
# Bind-mount the store read-write in a private namespace.
PrivateMounts=true
BindPaths=/gnu/store
MountFlags=private
Type=exec
AmbientCapabilities=CAP_CHOWN
StandardOutput=journal
StandardError=journal
OOMPolicy=continue
Restart=always
TasksMax=8192

[Install]
WantedBy=multi-user.target
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Note that, when building from sources in specific cases, it could be a good idea to provide an additional TMPDIR environment variable to bypass the limited size of the /tmp directory (specifically for tmpfs implementation as for Debian 13+). For instance, building a full Linux kernel could require more than 32 GB of storage available in /tmp, which corresponds by default to at least 64 GB of RAM on the system. A typical personal box can be quite limited for that. So adding &lt;code&gt;TMPDIR=/var/tmp&lt;/code&gt; to
the &lt;em&gt;Environment&lt;/em&gt; variable could be a sane idea.&lt;/p&gt;&lt;h2 id=&quot;setting-up-guix-publish&quot;&gt;Setting up Guix Publish&lt;/h2&gt;&lt;p&gt;To set up the substitute server, a &lt;code&gt;guix publish&lt;/code&gt; process must be started via
systemd. First, create a publishing asymmetric key pair and a destination for
the cache directory:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;$ sudo -i guix archive --generate-key
$ sudo mkdir -p /var/cache/guix/publish
$ sudo chown guix-daemon:guix-daemon /var/cache/guix/publish
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This is the systemd unit file for the &lt;code&gt;guix-publish.service&lt;/code&gt;:&lt;/p&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot;&gt;[Unit]
Description=Guix substitute server
After=network.target

[Service]
Type=simple
User=root
Environment='GUIX_LOCPATH=/root/.guix-profile/lib/locale'
ExecStart=/var/guix/profiles/per-user/root/current-guix/bin/guix publish \
  --listen=0.0.0.0 \
  --port=8080 \
  --user=guix-daemon \
  --compression=gzip:9 \
  --compression=lzip:9 \
  --cache=/var/cache/guix/publish \
  --ttl=30d --negative-ttl=1h \
  --workers=4
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This will start the service in unprivileged mode on an unprivileged port, which
can be easily routed via an NGINX proxy, for instance (my preferred way). I use
this system to route the service on both the home and the at-work LANs.&lt;/p&gt;&lt;p&gt;Once done, of course, the next point is defining a policy to populate such a
server. While it could be nice running a proper
&lt;a href=&quot;https://guix.gnu.org/cuirass/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;cuirass&lt;/a&gt; build service to run continuously
building from a custom repository, it is also perfectly fine simply using a
manifest file with common packages or the multiple configurations used by
personal boxes.  Here is a series of alternatives to build a handful of
packages.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;guix build gcc
guix system build my-laptop-config.scm
guix build -m manifest.scm
guix build make cmake vim emacs perl
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;A simple manifest example:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;(specifications-&amp;gt;manifest
 '(&amp;quot;gcc-toolchain&amp;quot;
   &amp;quot;python&amp;quot;
   &amp;quot;emacs&amp;quot;
   &amp;quot;git&amp;quot;
   &amp;quot;make&amp;quot;
   &amp;quot;cmake&amp;quot;
   &amp;quot;perl&amp;quot;
   &amp;quot;grass&amp;quot;
   &amp;quot;gdal&amp;quot;
   &amp;quot;geos&amp;quot;
   &amp;quot;gawk&amp;quot;
   &amp;quot;vim&amp;quot;
   ;; Add more packages...
))&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Of course, a very simple strategy could consist of running regular pulls &amp;amp;
builds for all packages of primary interest and making frequent enough purges
of the data store to avoid excessive storage consumption. That can be avoided
if plenty of space is available for builds.&lt;/p&gt;&lt;p&gt;Once setup the server and populating it, it is possibile to add its URL to the
configurations of all personal/LAN boxes for foreign and native installations,
and live peacefully.&lt;/p&gt;&lt;p&gt;&lt;em&gt;Happy guixing, folks!&lt;/em&gt;&lt;/p&gt;</content></entry><entry><title>About computing environments for reproducible science</title><id>https://lovergine.com/about-computing-environments-for-reproducible-science.html</id><author><name>Francesco P. Lovergine</name><email>mbox@lovergine.com</email></author><updated>2025-12-09T13:00:00Z</updated><link href="https://lovergine.com/about-computing-environments-for-reproducible-science.html" rel="alternate" /><content type="html">&lt;p&gt;A few weeks ago I gave a lecture for the &lt;a href=&quot;https://spatial-ecology.net/course-geocomputation-machine-learning-for-environmental-applications-intermediate-level-2025/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Spatial Ecology
course&lt;/a&gt;
to introduce a handful of junior and not-so-junior researchers from various
domains to the not-so-nice world of scientific computing environments.&lt;/p&gt;&lt;p&gt;&lt;img src=&quot;/images/galileo.png&quot; alt=&quot;Poor Galileo working on modern computer&quot; /&gt;&lt;/p&gt;&lt;p&gt;For people interested,
&lt;a href=&quot;https://spatial-ecology.net/docs/source/lectures/lect_20252511_dependency_management_in_data_science.pdf&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;here&lt;/a&gt;
are my slides about this topic. They are somehow specialized for the Python
ecosystem (which has become nowadays the programming language adopted for
scientific computing in multiple contexts), where, in the last few years, a lot
of evolutions have taken place for the management of dependencies and the
management of the computing environment. This problem is amplified in the HPC
context (I already wrote &lt;a href=&quot;/does-hpc-mean-high-pain-computing.html&quot;&gt;a semi-serious post&lt;/a&gt; about such an argument).&lt;/p&gt;&lt;p&gt;I also cited &lt;a href=&quot;https://guix.gnu.org/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;&lt;em&gt;guix&lt;/em&gt;&lt;/a&gt; without more details (it was impossible to deal with all
sub-topics in the lecture, and I know that multiple listeners already had
problems fully understanding the matter).&lt;/p&gt;&lt;p&gt;Reasoning about that, it is not a silly idea to write some blog notes about the
whole topic. First of all, what is the context? &lt;a href=&quot;https://pmc.ncbi.nlm.nih.gov/articles/PMC2981311/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Reproducible science&lt;/a&gt;
is not a novel matter. Any scientific experiment should be reproducible, starting from the same
data and giving comparable results: this is the basis of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Scientific_method&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;scientific method&lt;/a&gt;
(Galileo docet). In the
context of scientific computing, that implies that the whole execution
environment should be fully reproducible in order to ensure the possibility of
replication of the executions, with the same outputs starting from the same
inputs. Possibly later on, running on the same platform, or after deployment
on a new, completely different system.&lt;/p&gt;&lt;p&gt;The key point is that the long-term reproducibility of such results on current
platforms and with current languages is minimal, to be generous.  Having the
full source code of a Python notebook, a git source repository, or anything
comparable is simply only the starting point. The sad reality is that in
practice, the source code has, in too many cases, a lifetime of a few months
because of the understimation of such a problem by the average scholar. When
following a few good practices, such a lifetime can be extended to a few years,
maybe.&lt;/p&gt;&lt;p&gt;When I wrote my thesis, too many years ago, I developed the whole C source for
execution on a parallel computer of the time. It was a &lt;a href=&quot;https://en.wikipedia.org/wiki/Meiko_Scientific&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Meiko Computing Surface&lt;/a&gt;,
a SIMD platform based on &lt;a href=&quot;https://en.wikipedia.org/wiki/Transputer&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;INMOS Transputers&lt;/a&gt;. The C code
used a proprietary message-passing library, CSTools, to enable communication
among T-800 processors (unfortunately, there is no relation with the Terminator
series, sorry). Now, it is somewhat expected that a code based on a dead
proprietary library running on a dead hardware platform could have
reproducibility issues today, after more than 30 years.&lt;/p&gt;&lt;p&gt;What is unexpected is that one could have the same reproducibility problems
after 30 months, or in some limited cases, after 30 days. I mean both at the
binary and source levels, often. Now, part of the problem is due to the &lt;a href=&quot;https://www.merriam-webster.com/slang/fafo&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;FAFO&lt;/a&gt;
attitude of some development communities. Not all teams are like the GDAL
one, which is capable of maintaining the same well-refined APIs for dozens of
years. More usually, from time to time, new versions of libraries and tools
introduce expected or unexpected breakages against past versions and APIs, which
backfire on programs that use them. In other cases, new versions can fix and/or
introduce bugs of primary interest for dependent software. Those are the main
reasons to meticulously annotate and document every single version of direct and
indirect dependencies. This is somewhat solved by dependency resolvers, as
explained in my lecture. But that's only part of the whole chain.&lt;/p&gt;&lt;p&gt;Unfortunately, nowadays this chain of dependencies traverses a single language
and crashes against system-level dependencies, including the whole operating
system, with its system compilers, interpreters, and libraries. This problem is
amplified in a fully containerized world, which is nowadays used intensively.
Depending on a third-party-provided binary image taken from any hub out there is
not a safer approach. Such images can disappear from night to day or have a
limited lifetime, so the conscious scholar should also develop his/her own from
scratch, which often is particularly out of the skill perimeter of the average
scholar.&lt;/p&gt;&lt;p&gt;This is exactly where Guix tries to give an answer. Guix is a source-level
package manager with a set of full descriptions written in Guile Scheme for the
whole chain of dependencies up to the kernel level. Combining such an analytical
description of the system for any built artifact in the timeline from the
starting point (derivations), along with the possibility to use build systems to
cache binary artifacts (substitutes), and install any software at the user
level, does allow the creation of a source-level definition of a full execution
environment.&lt;/p&gt;&lt;p&gt;Such an ambitious goal is not without problems, as magistrally summarized by
Ludovic Courtès
&lt;a href=&quot;https://hpc.guix.info/blog/2024/03/adventures-on-the-quest-for-long-term-reproducible-deployment/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;here&lt;/a&gt;,
but anyway it is at light-years of distance from the possibility of the average
deployment system that needs instead continuous babysitting in order to ensure a
working environment.&lt;/p&gt;&lt;p&gt;What is probably of interest for general consumption would also be a consistent additional
security tagging for derivations in order to fast identify sources with known
CVE-tagged versions in the chain of dependencies. That would increase the level
of self-awareness when the Guix time machine is used to go back in the past and
pick some sources from Pandora's box. It would also be of considerable interest
in the &lt;a href=&quot;https://en.wikipedia.org/wiki/Software_supply_chain&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;SBOM&lt;/a&gt; context
outside the perimeter of science computing.&lt;/p&gt;&lt;p&gt;So, guix is not perfect, but again a sure advancement towards reproducible computing
environments, which currently lack in a way or another in the science domain
(and not only that).&lt;/p&gt;&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;&lt;p&gt;[1] &lt;a href=&quot;https://hpc.guix.info/blog/2023/06/a-guide-to-reproducible-research-papers/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;A guide to reproducible research papers&lt;/a&gt;&lt;/p&gt;&lt;p&gt;[2] &lt;a href=&quot;https://zenodo.org/records/7088068&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Guix as a tool for reproducible science&lt;/a&gt;&lt;/p&gt;&lt;p&gt;[3] &lt;a href=&quot;https://inria.hal.science/hal-04776900/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Using Guix for managing reproducible, flexible, and collaborative environments in a PhD thesis&lt;/a&gt;&lt;/p&gt;&lt;p&gt;[4] &lt;a href=&quot;https://doi.org/10.1101/29865o3&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Reproducible genomics analysis pipelines with GNU Guix&lt;/a&gt;&lt;/p&gt;&lt;p&gt;[5] &lt;a href=&quot;https://en.wikipedia.org/wiki/Replication_crisis&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Replication crisis&lt;/a&gt;&lt;/p&gt;</content></entry><entry><title>Guix for geeks</title><id>https://lovergine.com/guix-for-geeks.html</id><author><name>Francesco P. Lovergine</name><email>mbox@lovergine.com</email></author><updated>2025-09-03T19:40:00Z</updated><link href="https://lovergine.com/guix-for-geeks.html" rel="alternate" /><content type="html">&lt;p&gt;In the last few months, I have installed and upgraded my second preferred
GNU/Linux system, GNU Guix, on multiple boxes. Regarding that system, I have
already &lt;a href=&quot;https://lovergine.com/tags/guix.html&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;written a few introductory posts&lt;/a&gt;
in the recent past. This is an update
about my experiences as a user and developer. I still think Guix is a giant
step forward in packaging and management, in comparison with Debian and other
distributions, for elegance and inner coherence.&lt;/p&gt;&lt;p&gt;On the negative side, I can confirm that the most important aspects to consider
in order to adopt Guix for daily use are as follows.&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;Guix is essentially a
roll-on type of distribution with a limited user base, so a grain of salt is
required at upgrade time because instabilities are somehow expected. The
integrated time machine can be used to step back in case of problems, anyway.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;The development team and other support teams are tiny enough that I would avoid
using Guix for publicly exposed services. Also, it can lag on specific
applications and issues. Tasks and goals do not specifically structure teams,
so there is no proper security team, but I guess all maintainers can
participate to cover all required tasks.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Packages are not always up-to-date
with the latest upstream versions. Some packages are even older than in Debian
stable, so if you are looking for the latest and coolest products, that's not
the place.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Some choices for the core distribution are not mainstream, such as
using shepherd as its init system instead of systemd. This implies some delays
because patches are sometimes due for complex software, such as Gnome, which
introduced strict dependencies on systemd in recent years. This is the reason
why, as of the current date, Gnome is still at version 46, while Debian stable
is at version 48.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;The geospatial tools and libraries available are still quite
limited, which may require a more in-depth analysis to estimate the level of
lag. See the section below.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;The readiness for immediate use is not comparable
to the main distributions. For instance, if one absolutely needs a non-free
Linux kernel due to firmware constraints, the nonguix add-on repository is
available; however, one must build and install an ad hoc ISO installer by hand.
Nothing transcendental, but complicated enough to discourage most users. &lt;a href=&quot;https://github.com/fpl/guix-installer/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Here&lt;/a&gt;
is my fork of the &lt;a href=&quot;https://systemcrafters.net/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;System Crafters&lt;/a&gt; repository to prepare such an ISO image,
updated for use of the current main Guix (now hosted on Codeberg) and NonGuix
channels. That could be easily prepared on any foreign distribution that
includes the &lt;code&gt;guix&lt;/code&gt; package management software, such as Debian.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;As of the current date, I have installed at least a few laptops and VMs,
including a Dell Inspiron 15, an Asus EEE 1215P, and an old Acer Travelmate. I
strongly suggest using at least a box with 8GB of RAM and a 512GB SSD, because
building from sources can be overwhelming. My dual-core Atom EEE Pc has only 2
GB of RAM, and it is slow enough, but it has the big advantage of being fully
supported by the official GNU Linux libre kernel.&lt;/p&gt;&lt;p&gt;Additionally, I believe that having a local build host for substitutions within
the home/work LAN is the most efficient solution. That is because the
officially provided worldwide substitution hosts could be generally heavily
loaded and occasionally fail (when that happens, the time of recovery is on a
best effort basis).&lt;/p&gt;&lt;p&gt;Of course, it is also entirely possible to use Guix only as a package
management system on a foreign distribution, having most of the advantages of a
reproducible environment, as well as within a container or a virtual machine.
In that case, one has to consider that the host system is typically based on
the systemd init system, which can cause a few headaches when porting existing
package descriptions for services taken from the Guix repository. Probably the
best compromise is still using a foreign distribution on the physical box and a
Guix-based container to prepare an execution environment, something I already
experimented as explained in previous posts.&lt;/p&gt;&lt;h2 id=&quot;guix-and-geospatial-software&quot;&gt;Guix and geospatial software&lt;/h2&gt;&lt;p&gt;In 2004, Paolo Cavallini and I started a subproject within the Debian community
of developers and users to improve the status of geospatial software in Debian.
That was the birth of what is today the
&lt;a href=&quot;https://www.debian.org/blends/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;DebianGIS pure blend&lt;/a&gt;, with a mildly
coordinated team of developers and maintainers that work together in Debian
(and derivative distributions) on a set of essential libraries and tools for
the geospatial community. For people interested in the history of FOSS, I wrote
a &lt;a href=&quot;http://atti.asita.it/Asita2009/Pdf/069.pdf&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;contribution to the ASITA
conference in 2009 about that&lt;/a&gt;. That was and still is grunt work, often
neglected and at the time perceived as a secondary effort by upstream
developers. Indeed, that is an essential task instead, because collecting
together properly and ensuring that you have a complete and well-built stack of
software for a geospatial application is not trivial at all.&lt;/p&gt;&lt;p&gt;One of such base libraries is GDAL, which can be built with multiple optional
dependencies and plugins. Like other platforms, some of those optional
dependencies are missing in the Guix package, and that should be taken into
consideration. Some tools are instead totally missing, such as MapServer and
others. Of course, some packages could be patched here and there in Debian, or
can require a Guix-specific patching (because of the peculiarities of such a
system, which does not respect the Linux FHS), and that definitely could be a
reason to have a package in good shape or not. That's to say that the Guix
ecosystem would need a
serious help for packaging such niche packages, but where most people can see a
lack, I see an opportunity in that regard. After all, when I started my life in
the Debian project, it was because I did not trust an operating environment
that I could not develop and adjust personally for whatever reason.  That's the
way and Guix seems a brilliant example of a vibrant community for that.&lt;/p&gt;</content></entry><entry><title>Playing with Vagrant, Virtualbox and Guix</title><id>https://lovergine.com/playing-with-vagrant-virtualbox-and-guix.html</id><author><name>Francesco P. Lovergine</name><email>mbox@lovergine.com</email></author><updated>2024-09-04T18:20:00Z</updated><link href="https://lovergine.com/playing-with-vagrant-virtualbox-and-guix.html" rel="alternate" /><content type="html">&lt;p&gt;It is specifically convenient using &lt;code&gt;Guix-the-system&lt;/code&gt; within a &lt;em&gt;foreign distribution&lt;/em&gt;,
such as Debian, for development and tests. The package management
system can be used on top of the system, but I find it quite interesting to
explore the potential of the Guix distribution in the context of virtualized
environments. For personal use, that is also the ideal way to avoid breaking
your own daily boxes every couple of days with daredevil approaches to personal
computing.&lt;/p&gt;&lt;p&gt;I find it quite handy to use &lt;a href=&quot;https://www.vagrantup.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Vagrant&lt;/a&gt; to synthetically describe multiple virtual hosts within a virtual network, by means of a single &lt;code&gt;Vagrantfile&lt;/code&gt;. Nowadays, there are
multiple &lt;em&gt;virtualization systems&lt;/em&gt; usable for the same purpose, including the &lt;code&gt;libvirt&lt;/code&gt; ecosystem. Under the hood, those systems can generally manage multiple virtual machine engines (or even cloud systems). Vagrant under Debian can use either &lt;a href=&quot;https://libvirt.org/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;&lt;em&gt;Libvirt+KVM&lt;/em&gt;&lt;/a&gt; or &lt;a href=&quot;https://virtualbox.org/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;&lt;em&gt;Virtualbox&lt;/em&gt;&lt;/a&gt; (the default one used by the upstream Vagrant) as primary engines.&lt;/p&gt;&lt;p&gt;Users can develop their own Vagrant images (called &lt;em&gt;boxes&lt;/em&gt;) or use those made available on the Hashicorp cloud, as developed by third-party teams (which is the common case).&lt;/p&gt;&lt;p&gt;Unfortunately, while there are &lt;a href=&quot;https://app.vagrantup.com/debian/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;a handful&lt;/a&gt; of Debian boxes developed by &lt;a href=&quot;https://wiki.debian.org/Teams/Cloud/VagrantBaseBoxes&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;the Debian Cloud Team&lt;/a&gt;, like many other ones for multiple distributions and releases, this is not the case for Guix. At the time of this post, there is only &lt;a href=&quot;https://portal.cloud.hashicorp.com/vagrant/discover?query=guix&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;a single box&lt;/a&gt; created some years ago by &lt;a href=&quot;https://github.com/palfrey/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Tom Parker-Shemilt&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;Of course, the Guix team also made a &lt;code&gt;qcow2&lt;/code&gt; image available to run a virtualized desktop machine under a QEMU/KVM system, as explained &lt;a href=&quot;https://guix.gnu.org/manual/en/html_node/Running-Guix-in-a-VM.html&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;in the manual&lt;/a&gt;. What is described in this post can also be easily applied to create an alternative custom implementation with QEMU. What is required is to create a virtual disk image of some kind and use it to populate a custom distribution configuration via &lt;code&gt;guix&lt;/code&gt;. The resulting image will be runnable under a suitable virtualization system in the host foreign distribution.&lt;/p&gt;&lt;p&gt;Let's assume to use any recent version of Vagrant and Virtualbox, both installed on the host system, along with the Guix package manager. The following are the steps required to create a Vagrant box with a minimal configuration of Guix that is compatible (with some limitations) with Vagrant and can be used to run any number of Guix VMs. Each Guix vm can be reconfigured for specific goals using multiple configurations.&lt;/p&gt;&lt;p&gt;In this case, we will not need to use &lt;a href=&quot;https://www.packer.io/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Packer&lt;/a&gt; to prepare a box because the &lt;code&gt;vagrant package&lt;/code&gt; command directly supports Virtualbox images with the same purpose.&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Create an empty &lt;a href=&quot;https://en.wikipedia.org/wiki/Virtual_disk_and_virtual_drive&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;virtual disk&lt;/a&gt; image and partition it.&lt;/li&gt;&lt;li&gt;Prepare a suitable configuration written in Guile for Guix.&lt;/li&gt;&lt;li&gt;Run an initial setup of the mounted virtual disk using &lt;code&gt;guix&lt;/code&gt; on your host.&lt;/li&gt;&lt;li&gt;Create a basic Virtualbox machine and attach the virtual disk to it.&lt;/li&gt;&lt;li&gt;Convert the machine into a Vagrant box and register it.&lt;/li&gt;&lt;li&gt;Prepare a Vagrantfile snippet and run the vm(s).&lt;/li&gt;&lt;li&gt;(Re)configure vm(s) on the basis of your needs.&lt;/li&gt;&lt;li&gt;Done!&lt;/li&gt;&lt;/ul&gt;&lt;h2 id=&quot;create-a-virtual-disk-image-and-partition-it&quot;&gt;Create a virtual disk image and partition it&lt;/h2&gt;&lt;p&gt;This is the straightforward part. Here, I'm using the &lt;code&gt;vdi&lt;/code&gt; format, the native Virtualbox one, but the VMware &lt;code&gt;vmdk&lt;/code&gt; format can be used instead.&lt;/p&gt;&lt;pre&gt;&lt;code&gt; # load the Network Block Device module
 sudo modprobe nbd
 # create a thin device
 qemu-img create -f vdi guix-hd.vdi 100G
 # ... mount it
 sudo qemu-nbd -f vdi --connect=/dev/nbd0 guix-hd.vdi
 # ... partition it 
 sudo parted /dev/nbd0 mklabel msdos
 sudo parted -a cylinder /dev/nbd0 mkpart primary ext4 1 93G
 sudo parted -a cylinder /dev/nbd0 mkpart primary linux-swap 93G 100%
 sudo parted /dev/nbd0 set 1 boot on 
 # ... create a suitable fs
 sudo mkfs.ext4 /dev/nbd0p1
 sudo mkswap /dev/nbd0p2
 # ... have a look to the partions IDs
 sudo blkid /dev/nbd0p1 
 sudo blkid /dev/nbd0p2
 # ... mount the root fs
 sudo mount /dev/nbd0p1 /mnt &lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;prepare-a-suitable-configuration-written-in-guile-for-guix&quot;&gt;Prepare a suitable configuration written in Guile for Guix&lt;/h2&gt;&lt;p&gt;Any valid configuration can be prepared, in this case this is a minimal one with
a pair of changes for Vagrant. Specifically, a &lt;code&gt;vagrant&lt;/code&gt; user in the &lt;code&gt;wheel&lt;/code&gt;
group needs to be added, and it should be able to run sudo without a
password. Even, the unsecure Vagrant key needs to be authorized to access via ssh.&lt;/p&gt;&lt;p&gt;Note that the key is added at the system level, and the root user has no password,
which should be appropriately changed after the first run or, even better, at
provisioning time. That is a requirement if the box would be exposed on public
network, because the default private and public keys of Vagrant are publicly distributed.&lt;/p&gt;&lt;p&gt;That is usually and automagically done by &lt;code&gt;vagrant&lt;/code&gt; at first boot, but Guix is a read-only system
and - as we will see - the Guix system is still not completely supported by Vagrant.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;ROOTFS_UUID=$(sudo blkid -o value /dev/nbd0p1|head -1)
SWAP_UUID=$(sudo blkid -o value /dev/nbd0p2|head -1)
DEVICE=/dev/nbd0

# Download the unsecure ssh key used by Vagrant
wget -q -O vagrant.pub https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub

cat &amp;gt;guix-config.scm &amp;lt;&amp;lt;EOF
;; Indicate which modules to import to access the variables
;; used in this configuration.
(use-modules (gnu))
(use-modules (gnu system))
(use-modules (gnu services avahi))
(use-service-modules desktop networking ssh)

;; Prepare a salt function for a less silly password encryption
(set! *random-state* (random-state-from-platform))
(define str &amp;quot;0123456789abcdefghijklmnopqrstuvwxyz&amp;quot;)
(define rnd-chr (lambda () (string-ref str (random (- (string-length str) 1)))))
(define salt (lambda () (string-append (string (rnd-chr)) (string (rnd-chr)) (string (rnd-chr)))))

(operating-system
  (locale &amp;quot;en_US.utf8&amp;quot;)
  (timezone &amp;quot;Europe/Rome&amp;quot;)
  (keyboard-layout (keyboard-layout &amp;quot;us&amp;quot; &amp;quot;intl&amp;quot;))
  (host-name &amp;quot;guix&amp;quot;)

  ;; The list of user accounts ('root' is implicit).
  (users (cons* (user-account
                  (name &amp;quot;vagrant&amp;quot;)
                  (comment &amp;quot;Vagrant user&amp;quot;)
                  (group &amp;quot;users&amp;quot;)
                  (home-directory &amp;quot;/home/vagrant&amp;quot;)
                  (password (crypt &amp;quot;vagrant&amp;quot; (string-append &amp;quot;\$6\$&amp;quot; (salt))))
                  (supplementary-groups '(&amp;quot;wheel&amp;quot; &amp;quot;netdev&amp;quot; &amp;quot;audio&amp;quot; &amp;quot;video&amp;quot;)))
                %base-user-accounts))

  ;; Packages installed system-wide.  Users can also install packages
  ;; under their own account: use 'guix search KEYWORD' to search
  ;; for packages and 'guix install PACKAGE' to install a package.
  (packages (append (list (specification-&amp;gt;package &amp;quot;nss-certs&amp;quot;)
                          (specification-&amp;gt;package &amp;quot;rsync&amp;quot;))
                    %base-packages))

  ;; Below is the list of system services.  To search for available
  ;; services, run 'guix system search KEYWORD' in a terminal.
  (services
   (append (list (service dhcp-client-service-type)
                 (service openssh-service-type
                    ;; here the official unsecure Vagrant ssh key is used...
                    (openssh-configuration
                      (authorized-keys \`((&amp;quot;vagrant&amp;quot; ,(local-file &amp;quot;vagrant.pub&amp;quot;)))))))

           ;; This is the default list of services we
           ;; are appending to.
           %base-services))

  ;; Authorize vagrant to run sudo without password.
  (sudoers-file
    (plain-file &amp;quot;sudoers&amp;quot;
                 (string-append (plain-file-content %sudoers-specification)
                                &amp;quot;vagrant ALL=(ALL) NOPASSWD: ALL\\n&amp;quot;)))

  (bootloader (bootloader-configuration
                (bootloader grub-bootloader)
                (targets (list &amp;quot;$DEVICE&amp;quot;))
                (keyboard-layout keyboard-layout)))
  (swap-devices (list (swap-space
                        (target (uuid
                                 &amp;quot;$SWAP_UUID&amp;quot;)))))

  ;; The list of file systems that get &amp;quot;mounted&amp;quot;.  The unique
  ;; file system identifiers there (&amp;quot;UUIDs&amp;quot;) can be obtained
  ;; by running 'blkid' in a terminal.
  (file-systems (cons* (file-system
                         (mount-point &amp;quot;/&amp;quot;)
                         (device (uuid
                                  &amp;quot;$ROOTFS_UUID&amp;quot;
                                  'ext4))
                         (type &amp;quot;ext4&amp;quot;)) %base-file-systems)))
EOF&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;run-an-initial-setup-of-the-mounted-virtual-disk-using-guix-on-your-host&quot;&gt;Run an initial setup of the mounted virtual disk using &lt;code&gt;guix&lt;/code&gt; on your host&lt;/h2&gt;&lt;p&gt;The &lt;code&gt;system init&lt;/code&gt; can be run more than once, if required.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;sudo guix pull # only if needed to update packages...
sudo guix system init guix-config.scm /mnt
sudo umount /mnt
sudo qemu-nbd --disconnect /dev/nbd0&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;create-a-basic-virtualbox-machine-and-attach-the-virtual-disk-to-it&quot;&gt;Create a basic Virtualbox machine and attach the virtual disk to it&lt;/h2&gt;&lt;p&gt;Now, the virtual disk should already be registered and visibile under your Virtualbox configuration.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;VDI_UUID=`vboxmanage showhdinfo guix-hd.vdi|grep ^UUID|awk '{print $2}'` &amp;amp;&amp;amp; echo $VDI_UUID&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;should show the hexadecimal code associated to the now populated disk. It is now possible to create
a simple virtual machine, for instance:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;vboxmanage createvm --name=Guix --default --ostype=Linux_64 --register
vboxmanage modifyvm Guix --memory=4096 --cpus=2 --ioapic=on --vram=256 --cpu-profile=host \
                --audio-enabled=off --usb-xhci=off --usb-ehci=off --usb-ohci=off --mouse=ps2
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;and attach the virtual disk to it, as follows:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;vboxmanage storageattach Guix --storagectl=SATA --type=hdd --port=0 --device=0 --medium=$VDI_UUID
vboxmanage showvminfo Guix&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;convert-the-machine-into-a-vagrant-box-and-register-it&quot;&gt;Convert the machine into a Vagrant box and register it&lt;/h2&gt;&lt;p&gt;The resulting vm can be directly used under Virtualbox, but the final touch is creating a proper Vagrant box to recycle and possibly publish on the cloud.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;vagrant package --base Guix --output guix-small.box
vagrant box add guix-small.box --name=guix-small
vagrant box list&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Now the new box is ready for use in multiple configurations within a &lt;code&gt;Vagrantfile&lt;/code&gt;.&lt;/p&gt;&lt;h2 id=&quot;prepare-a-vagrantfile-snippet-and-run-the-vm-s&quot;&gt;Prepare a Vagrantfile snippet and run the vm(s)&lt;/h2&gt;&lt;p&gt;A simple &lt;code&gt;Vagrantfile&lt;/code&gt; can be used to create an instance of the box, such as:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;Vagrant.configure(&amp;quot;2&amp;quot;) do |config|
    config.vm.define &amp;quot;guix1&amp;quot; do |vm1|
     vm1.vm.box = &amp;quot;guix-small&amp;quot;
     vm1.vm.network &amp;quot;private_network&amp;quot;, ip: &amp;quot;192.168.1.2&amp;quot;
     vm1.vm.provider &amp;quot;virtualbox&amp;quot; do |vb1|
        vb1.memory = &amp;quot;8192&amp;quot;
    	vb1.name = &amp;quot;guix8G&amp;quot;
    	vb1.cpus = 4
    end
    config.vm.provision &amp;quot;shell&amp;quot;, inline: &amp;lt;&amp;lt;-SHELL
        guix pull
        guix install htop 
     SHELL
    end
end&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;A new machine can be created, started up and connected easily, with also an initial provisioning, by issuing:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;vagant up guix1
vagrant ssh guix1&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;re-configure-vm-s-on-the-basis-of-your-needs&quot;&gt;(Re)configure vm(s) on the basis of your needs&lt;/h2&gt;&lt;p&gt;Both the box and the dependent virtual machines can be reconfigured as usual by &lt;code&gt;guix system reconfigure&lt;/code&gt; in the guest
or even remounting the original virtual disk (or any of the &lt;code&gt;vmdk&lt;/code&gt; copies cloned by Vagrant) as previously done, then
re-issuing a &lt;code&gt;system init&lt;/code&gt; with a new Guile configuration. Note that the same &lt;code&gt;reconfigure&lt;/code&gt; can also be run as described
&lt;a href=&quot;https://guix.gnu.org/manual/devel/en/html_node/Chrooting-into-an-existing-system.html&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;in the manual&lt;/a&gt;.&lt;/p&gt;&lt;h2 id=&quot;missing-features-in-vagrant-to-support-guix&quot;&gt;Missing features in Vagrant to support Guix&lt;/h2&gt;&lt;p&gt;Vagrant needs to recognize the installed system in order to perform a few operations, but unfortunately that is still not the
case for Guix. Specifically, that prevents the capability of halting the system, which is not exactly a nice thing. That must
be done manually by running &lt;code&gt;halt&lt;/code&gt; within an ssh session. For the same reason, Vagrant is not able to fully configure networking,
so the second network interface shown in the previous &lt;code&gt;Vagrantfile&lt;/code&gt; needs to be configured manually by adding a suitable
&lt;code&gt;static-networking-service-type&lt;/code&gt; section to the Guile configuration.&lt;/p&gt;&lt;p&gt;A suitable support would need to be added as a proper
&lt;a href=&quot;https://developer.hashicorp.com/vagrant/docs/plugins/guests&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;vagrant plugin&lt;/a&gt;
as in the case of other operating systems and distributions.
So, good but not good enough, maybe it is matter for another post, even if I'm not exactly a Ruby language fan.&lt;/p&gt;&lt;p&gt;In the meantime, have a good time by upping and destroying Vagrant Guix boxes.&lt;/p&gt;</content></entry><entry><title>The Guix system, take two</title><id>https://lovergine.com/the-guix-system-take-two.html</id><author><name>Francesco P. Lovergine</name><email>mbox@lovergine.com</email></author><updated>2024-09-02T20:00:00Z</updated><link href="https://lovergine.com/the-guix-system-take-two.html" rel="alternate" /><content type="html">&lt;p&gt;Let's give a second look at &lt;code&gt;Guix-the-system&lt;/code&gt; the main GNU Project distribution
I dealt with in &lt;a href=&quot;http://lovergine.com/an-initial-dive-into-guix.html&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;a previous
post&lt;/a&gt;.  This post is not
specifically limited to the distribution, it is also of interest when using Guix
in a foreign distribution, even if some configuration details change.&lt;/p&gt;&lt;h2 id=&quot;substitutes-and-grafts&quot;&gt;Substitutes and grafts&lt;/h2&gt;&lt;p&gt;As said previously, the daily use of a store-based rolling distribution adds
some overhead to the system at both upgrade and installation time. This pain
(that remembers me the old times of the source-based &lt;a href=&quot;https://gentoo.org&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Gentoo
distribution&lt;/a&gt; with its &lt;code&gt;emerge&lt;/code&gt; tool) is specifically
alleviated by the use of the so-called &lt;code&gt;substitutes servers&lt;/code&gt;, which provide
pre-built binaries for the base system, as well as alternative/unofficial
packages, too.&lt;/p&gt;&lt;p&gt;The &lt;em&gt;fall-back&lt;/em&gt; alternative is based on regular build-from-sources on the host
system, which could imply long times for both installations and distribution
upgrades. The official Guix system comes with a couple of official substitutes
(i.e., &lt;code&gt;ci.guix.gnu.org&lt;/code&gt; and &lt;code&gt;bordeaux.guix.gnu.org&lt;/code&gt;) but others can be added,
including possibly any suitable user's server in the LAN.&lt;/p&gt;&lt;p&gt;Another trick in Guix for alleviating the need for long &lt;em&gt;local&lt;/em&gt; rebuilds is the
use of &lt;em&gt;grafts&lt;/em&gt; that are sort of &lt;em&gt;in-place&lt;/em&gt; replacements for binary
dependencies, expressed at the source level. To explain in brief, if a package &lt;code&gt;A@1&lt;/code&gt;
has been replaced by &lt;code&gt;A@2&lt;/code&gt; and they both maintain the same ABI, any &lt;em&gt;reverse
dependency&lt;/em&gt; &lt;code&gt;B&lt;/code&gt; can avoid being rebuilt. This is called a &lt;em&gt;graft&lt;/em&gt; in Guix, and
greatly simplifies the long chains of forced rebuilds in many cases (for
instance, in case of security upgrades). Specifically, the &lt;code&gt;@&lt;/code&gt; in a Guix package
is the version separator.&lt;/p&gt;&lt;h2 id=&quot;a-monorepo-for-the-whole-distribution&quot;&gt;A monorepo for the whole distribution&lt;/h2&gt;&lt;p&gt;The Guix source archive is strictly based on &lt;code&gt;git&lt;/code&gt; and distributed development by
means of a &lt;a href=&quot;https://en.wikipedia.org/wiki/Monorepo&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;monorepo&lt;/a&gt;,
which, along with the need to represent the tree of dependencies for any
package and its updates at run-time require some operations that are specific
of the Guix package management approach:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;pulling&lt;/li&gt;&lt;li&gt;garbage collection&lt;/li&gt;&lt;li&gt;branching&lt;/li&gt;&lt;li&gt;using channels&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;The pull phase specifically could require ages (hours on my old low-end Asus
EEEpc), so it is an operation that should be applied typically in batch mode and quite often
in order to minimize execution times. It is not a potentially destructive
operation - similar to an &lt;code&gt;apt update&lt;/code&gt; with steroids - so it is better
to perform it quite often, every few days. At the end of the day, it does not
alter the status of the system, so it is safe enough for background execution.&lt;/p&gt;&lt;p&gt;The &lt;code&gt;gc&lt;/code&gt; operation works directly on the store to purge &lt;em&gt;obsolete&lt;/em&gt; (out of
the current status tree of dependencies) entries. If you jump to a past status,
the purge would impact bandwidth and CPU loads, of course.&lt;/p&gt;&lt;p&gt;The &lt;code&gt;branch&lt;/code&gt; specification has the same role as any sane distributed
environment organization of code. It is usable to pull from separate branches of
archives, instead of following the default one, &lt;code&gt;latest&lt;/code&gt;. This feature can be
paired with the Guix &lt;em&gt;time-machine&lt;/em&gt; to jump to any past tree of packages in the
chronology of the archive sources.&lt;/p&gt;&lt;p&gt;Finally, a &lt;em&gt;channel&lt;/em&gt; is simply an alternative archive of sources that is prepared
by third-party teams to integrate the official Guix one. For instance, a few independent
packages are offered by &lt;a href=&quot;https://www.inria.fr/en&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;INRIA&lt;/a&gt; and other institutions for
&lt;a href=&quot;https://hpc.guix.info/about/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;the HPC community&lt;/a&gt;, as well as an handful of non-free
packages hosted on &lt;a href=&quot;https://gitlab.com/nonguix/nonguix&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;the nonguix repository&lt;/a&gt; to
solve the well-known users-hostages' dilemma about using closed-source firmwares
and a few other proprietary stuff.&lt;/p&gt;&lt;h2 id=&quot;one-scheme-to-rule-them-all&quot;&gt;One Scheme to Rule Them All&lt;/h2&gt;&lt;p&gt;An exciting feature of Guix-the-System is the use of &lt;a href=&quot;https://www.gnu.org/software/guile/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Guile&lt;/a&gt;
to describe the whole system, including the core, all services, and even users.
In perspective, all installed packages could be also fully configured by using functional
Guile snippets of code. This is something currently done in Debian only in
a limited way, through &lt;code&gt;debconf templates&lt;/code&gt; and &lt;code&gt;dpkg selections&lt;/code&gt;.
In practice, today, one has to use &lt;code&gt;ansible&lt;/code&gt; or similar tools to declare
configurations in some &lt;em&gt;ad hoc&lt;/em&gt; DSL, using
tons of plugins and templates, case by case. In a word, it is a mess.&lt;/p&gt;&lt;p&gt;This is, at least for me, the most intriguing feature and open exciting possibilities.&lt;/p&gt;&lt;p&gt;Currently, any developer with a reasonably decent computer can easily use Guix to rebuild and customize
Guix itself by starting from a monorepo fork, changing its main configuration and
adding/modifying packages in a totally independent and self-consistent way. Something that
in traditional distributions is done by a plethora of tools and interfaces, written in multiple
generale-purpose or specific languages, and often not wholly documented and held together
with the glue.&lt;/p&gt;&lt;p&gt;Once added a layer of general-purpose configurators for common packages the
whole distribution generation could become fully autoconsistent and complete for
any host or set of boxes. Isn't that challenging?&lt;/p&gt;&lt;h2 id=&quot;guix-in-foreign-distributions&quot;&gt;Guix in foreign distributions&lt;/h2&gt;&lt;p&gt;Using Guix as an additional package manager in a foreign distribution
has more limitations, of course. First of all, one must
deal with &lt;code&gt;systemd&lt;/code&gt; as the typical init system. Therefore, the general
configuration of the host cannot be expressed in a synthetic way as a
Scheme script. That said, it is perfectly possible to use Guix as
a development environment for multiple languages ecosystems, thanks
to various Guile build modules. Even, it is possible to run Guix-the-system
in a &lt;em&gt;container&lt;/em&gt; (or a &lt;em&gt;virtual machine&lt;/em&gt;), to use the host system just as a basic
platform and create Guix-based services and applications on top.&lt;/p&gt;&lt;p&gt;But those will be the topics for other posts...&lt;/p&gt;&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://guix.gnu.org/manual/en/html_node/Substitutes.html&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;https://guix.gnu.org/manual/en/html_node/Substitutes.html&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://guix.gnu.org/en/blog/2020/grafts-continued/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;https://guix.gnu.org/en/blog/2020/grafts-continued/&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://guix.gnu.org/en/manual/devel/en/html_node/Managing-Patches-and-Branches.html&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;https://guix.gnu.org/en/manual/devel/en/html_node/Managing-Patches-and-Branches.html&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://guix.gnu.org/manual/en/html_node/Complex-Configurations.html&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;https://guix.gnu.org/manual/en/html_node/Complex-Configurations.html&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.futurile.net/2023/05/01/guix-publish-caching-substitution-server/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;https://www.futurile.net/2023/05/01/guix-publish-caching-substitution-server/&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;</content></entry><entry><title>An initial dive into Guix</title><id>https://lovergine.com/an-initial-dive-into-guix.html</id><author><name>Francesco P. Lovergine</name><email>mbox@lovergine.com</email></author><updated>2024-08-18T19:00:00Z</updated><link href="https://lovergine.com/an-initial-dive-into-guix.html" rel="alternate" /><content type="html">&lt;p&gt;In the last few days, I got familiar with &lt;code&gt;Guix&lt;/code&gt;, which is both a modern package
management system and the main GNU Project distribution for Linux and Hurd (&lt;code&gt;the Guix system&lt;/code&gt;).
As a package management system, it can be installed on most &lt;em&gt;foreign distributions&lt;/em&gt;,
including Debian and any other, as an alternative/additional packaging system.&lt;/p&gt;&lt;p&gt;I both installed the Guix system natively on a small ancient laptop of mine
(an ASUS EEEpc 1215N), and
the Guix package manager on one of my Debian stable boxes. An interesting variant could
be installing the whole system under a container in a non-interactive
mode, but that may be a task for the future. Indeed, the last one could
be the most exciting application of Guix for reproducible deployment.&lt;/p&gt;&lt;h2 id=&quot;guix-the-package-manager&quot;&gt;Guix, the package manager&lt;/h2&gt;&lt;p&gt;Guix (the package management system) is the most interesting part. It is a &lt;em&gt;modern&lt;/em&gt;
system with multiple advanced features, inspired by &lt;a href=&quot;https://nixos.wiki/wiki/Nix_package_manager&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Nix&lt;/a&gt;,
a pre-existing system based on a JSON-based DSL.
Nix and Guix are both declarative and functional package managers with similar goals
for software maintenance.&lt;/p&gt;&lt;p&gt;Both of them declare to have the largest collection of FOSS packages in the world, but ok:
both currently have &lt;em&gt;hubs&lt;/em&gt; with tens of thousands of binary packages.
Maybe not the largest, but respectful.
Of course, Guix is an FSF project and therefore highly choosy about the software
that can be distributed within the Guix archives. That's not specifically different
from the Debian approach, but for the derogation that historically the Debian Project
considered for limited proprietary-but-distributable stuff (the non-free+contrib section).&lt;/p&gt;&lt;p&gt;One interesting aspect of Guix (at least for me) is that it is specifically
based on Guile, an extendable Scheme dialect which is the main DSL used in the GNU ecosystem.
All packages are expressed as small snippets of Guile functions that declare
pre-dependencies, as well as the build, installation and test phases of each software.&lt;/p&gt;&lt;p&gt;Anyone who has worked on software packaging in Debian from the beginning knows that
the mythical &lt;code&gt;debian/rules&lt;/code&gt; is essentially a &lt;em&gt;Makefile&lt;/em&gt; with steroids, accompanied
by a handful of declarative files, lately simplified by the use of some frameworks,
such as &lt;a href=&quot;https://joeyh.name/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;Joey Hess's&lt;/a&gt; &lt;code&gt;debhelper&lt;/code&gt; or others commonly used
in the past. Maybe not the most elegant approach to packaging and configuring, let me say.
Probably at the time - 30 years ago or so - the most pragmatic one, for sure. And it worked even for a lot of years.&lt;/p&gt;&lt;p&gt;In respect with traditional system-wide packaging, the Nix/Guix approach has several
interesting features:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;transitional, per-user, multi-profile capabilities&lt;/li&gt;&lt;li&gt;a rolling-back capability at the system and user level&lt;/li&gt;&lt;li&gt;an all-in-one system of packing with dependencies&lt;/li&gt;&lt;li&gt;a single expressive way of defining software configurations at both system-wide and per-user levels&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Guix &lt;em&gt;per se&lt;/em&gt; adds the use of Guile to all the rest so that all configurations are
synthetically expressed in S-exp, without the need to learn yet another DSL to
describe the software chains of dependencies.&lt;/p&gt;&lt;h2 id=&quot;guix-the-system&quot;&gt;Guix, the system&lt;/h2&gt;&lt;p&gt;The Guix free-software-only system has some interesting characteristics, including the use
of &lt;code&gt;shepherd&lt;/code&gt; as an alternative Guile-based &lt;em&gt;init system&lt;/em&gt; and the rolling-on distribution
style. The non-FHS basic organization of the filesystem could also pose some problems
to install software that are strictly dependent on that, that's for sure a good reason
to use Guix-on-Debian instead of Guix-the-system only. That issue is also partially mitigated
by a combination of a container technology support, and an FHS emulation layer.&lt;/p&gt;&lt;p&gt;In my opinion, the whole thing is quite interesting for building development environments
and exploring reproducible deployment systems.&lt;/p&gt;&lt;h2 id=&quot;the-gnu-touch&quot;&gt;The GNU touch&lt;/h2&gt;&lt;p&gt;But for the FSF strictly free approach to collecting software (including the missing firmware blobs
for the Linux-libre software, as for Debian until version 12), the Guix system has some typical
geek-only pillars for its ecosystem and community:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;strictly read the reference manuals and info files (i.e., do your homework)&lt;/li&gt;&lt;li&gt;use mailing lists&lt;/li&gt;&lt;li&gt;use IRC dedicated channels&lt;/li&gt;&lt;li&gt;use your brain and experience to solve issues&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Nothing different from the traditional Debian project community and approach to personal computing.
Therefore, nowadays something for geeky folk mainly, I guess.&lt;/p&gt;&lt;h2 id=&quot;issues-and-challenges&quot;&gt;Issues and challenges&lt;/h2&gt;&lt;p&gt;For sure, the user workflow to install and run software changes radically and in a very
different manner. One has the need to get familiar the Guix CLI interface and mode of operations.
The Guix approach to deployment and maintenance adds an evident overhead to the system
(for both storage and CPUs), partially
mitigated by the use of substitutes/hubs to reduce building from source requirements.
Not the best thing for old boxes, I guess.&lt;/p&gt;&lt;p&gt;Anyway, it is possible to use local &lt;em&gt;substitutes&lt;/em&gt; to reduce the load for
average systems. As a rolling distribution and/or software hub, I found it reasonably updated, but
that largely depends on applications and domains. Nobody makes miracles in those regards,
&lt;em&gt;DebianGis&lt;/em&gt; packages in &lt;em&gt;testing/unstable&lt;/em&gt; are more up-to-date for geospatial apps,
and probably even more flexible. Sorry, no silver bullet, guys.
Even Guix does not have (still?) a dedicated security team, so I would recommend it currently
only for personal/development use, not for servers.&lt;/p&gt;&lt;p&gt;An important feature of Guix is its support for reproducible software deployment, as an
alternative/integration to the ubiquitous containers, an aspect to deeply explore.&lt;/p&gt;&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;&lt;p&gt;The main resources about Guix are &lt;a href=&quot;https://guix.gnu.org/manual/en/html_node/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;the Reference Manual&lt;/a&gt;
and &lt;a href=&quot;https://guix.gnu.org/en/cookbook/en/html_node/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;The Cookbook&lt;/a&gt;, of course.
I found some interesting non-trivial articles about Guix and its internals on some &lt;em&gt;indie sites&lt;/em&gt;
here listed:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://systemcrafters.net/craft-your-system-with-guix/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;https://systemcrafters.net/craft-your-system-with-guix/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://www.futurile.net/archives.html&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;https://www.futurile.net/archives.html&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/techenthusiastsorg/awesome-guix&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;https://github.com/techenthusiastsorg/awesome-guix&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://hpc.guix.info/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;https://hpc.guix.info/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;</content></entry></feed>