How to Develop New Guile Libraries


Creating a new Guile Scheme library

Today we’re going to experiment with using Guile Hall and Guix to create a new Guile Scheme library from scratch! Guile Hall is a tool that can create a complete Guile project even with its own Guix packaging configuration.

Our Project

To test out the development workflow with these tools, we’ll write a simple URL route handling library like you might see in a minimal web programming framework (think Express.js, Flask, etc).


The goal will be to produce a simple library with basic tests and then consume it from a Guile Scheme script inside of a guix shell which has our Guile library installed!

Steps to use Hall for a project:

# Creating a project
cd ~/projects
hall init --author "Your Name" project-name -x

# Initializing the project build
cd project-name
hall build -x
guix shell -Df guix.scm -- autoreconf -vfi && ./configure && make check

# Building the project for development
guix shell -Df guix.scm -- make check

NOTE: The guix.scm file that is written out for --type local is wrong by default! Change source to (local-file "project-name-0.1.tar.gz")

To use your library as a Guix package:

# Make the local tarball
guix shell -Df guix.scm -- make dist

# Run a guix shell with the library installed
guix shell -f guix.scm guile # The guile part is needed!

Now you can load up your module in an arbitrary script!

The final code

Check out the code we created at this repository:

Subscribe to the System Crafters Newsletter!
Stay up to date with the latest System Crafters news and updates! Read the Newsletter page for more information.
Name (optional)
Email Address