Getting started with the Guix workflow language

Installation

This guide assumes GNU Guix and GNU GWL have been installed already. In case the GNU GWL hasn't been installed, run:

guix install gwl

Introduction

In the GWL there are two concepts we need to know about: processes and workflows. We describe a computation (e.g. running a program) using a process. With a workflow we describe how multiple processes relate to each other (process B must run after process A, process C must run before process A).

Processes and workflows are composed using a domain specific language embedded in the general purpose language Scheme. They can be executed in order with the guix workflow command.

Example

Let's start by writing the obligatory “Hello, world!” to see what a workflow might look like.

process: hello-world
  # { echo "Hello, world!" }

This text defines a process named ”hello-world” which would run a shell snippet that prints “Hello, world!” to the screen. Delightful!

Running programs

But the “hello-world” doesn't justify building yet another workflow language. When approaching the real world a little further, we use the software deployment strengths and reproducibility guarantees of GNU Guix by automating the deployment of a potentially complex software environment using the packages field.


process: samtools-index
  packages "samtools"
  inputs "/tmp/sample.bam"
  # {
    samtools index {{inputs}}
  }

workflow: do-the-thing
  processes samtools-index

The packages field declares that we want the samtools package to be available in the environment of this process. The package variant is fully determined by the version of Guix used and is installed automatically when the process is executed. It is important to list all packages required to run the process in the packages field.

We also defined a simple workflow named do-the-thing that executes just the samtools-index process.

On the next page, we will see how we can combine more processes in a workflow. We will also use process templates to generate processes from a list of input file names.