- Scheme 100%
| .guix | ||
| scripts | ||
| src | ||
| tests | ||
| .envrc | ||
| .gitignore | ||
| .guix-authorizations | ||
| .guix-channel | ||
| blueprint.scm | ||
| ChangeLog.md | ||
| guix.scm | ||
| manifest.scm | ||
| README | ||
| README.org | ||
guix compose
guix compose is a Guix extension implementing a compatibility layer between docker-compose.yml files and Guix' OCI backed services. Guix services have many advantages over docker-compose.yml services, starting from atomic upgrades and rollbacks to deployability on remote systems. They are also supposed to be OCI runtime agnostic, currently rootless Podman and Docker are supported. guix compose allows you to migrate your existing docker-compose.yml to Guix' own OCI provisioning API.
For example a simple file like:
services:
db:
image: postgres:alpine3.22
networks:
- bonfire
bonfire:
image: bonfirenetworks/bonfire
depends_on:
- db
networks:
- bonfire
nginx:
image: nginx:stable-alpine3.23-perl
networks:
- bonfire
depends_on:
- bonfire
ports:
- '80:80'
- '443:443'
networks:
bonfire:
would be converted by guix compose import docker-compose.yml to Guix code like
(oci-extension
(containers
(list (oci-container-configuration
(image "postgres:alpine3.22")
(provision "db"))
(oci-container-configuration
(image "bonfirenetworks/bonfire")
(provision "bonfire")
(requirement '(db)))
(oci-container-configuration
(image "nginx:stable-alpine3.23-perl")
(ports '("80:80" "443:443"))
(provision "nginx")
(requirement '(bonfire)))))
(networks
(list (oci-network-configuration (name "bonfire")))))
You can copy this add into your configuration with a simple-service, like it's shown in the manual in the above link.
Running guix compose from the main branch
If you have direnv command configured on your system, then you can enter the repository root and have an environment set up for you by direnv. Otherwise, once you are in the project root, you can set the following environment variables to run guix compose from sources:
eval "$(guix shell -m manifest.scm -D -f guix.scm --search-paths)"
export GUILE_LOAD_PATH="$(realpath src/):${GUILE_LOAD_PATH}"
export GUIX_EXTENSIONS_PATH="$(realpath src/guix/extensions):${GUIX_EXTENSIONS_PATH}"
Either way, now, you should be able to run the guix compose command from sources with:
guix compose --help
...
Usage: guix compose COMMAND [OPTION] FILE...
Provide a docker-compose.yml compatibility layer for Guix.
Available commands:
import generate Guix native configurations from a docker-compose.yml
--canonicalize-paths convert all referenced relative paths to absolute
--env-file specify an alternate environment file
-h, --help display this help and exit
-V, --version display version information and exit
-v, --verbosity=LEVEL use the given verbosity LEVEL
Please report bugs to https://codeberg.org/fishinthecalculator/guix-compose/issues .
Guix channel
To configure Guix for using this repository as a channel, you need to create a .config/guix/channels.scm file with the following content:
(cons* (channel
(name 'compose)
(url "https://codeberg.org/fishinthecalculator/guix-compose.git")
(branch "main")
;; Enable signature verification:
(introduction
(make-channel-introduction
"770b90897bde036329bdb325e5eb1c16c34e985d"
(openpgp-fingerprint
"8D10 60B9 6BB8 292E 829B 7249 AED4 1CC1 93B7 01E2"))))
%default-channels)
Otherwise, if you already have a .config/guix/channels.scm you can simply prepend this channel to the preexisting ones:
(cons* (channel
(name 'compose)
(url "https://codeberg.org/fishinthecalculator/guix-compose.git")
(branch "main")
;; Enable signature verification:
(introduction
(make-channel-introduction
"770b90897bde036329bdb325e5eb1c16c34e985d"
(openpgp-fingerprint
"8D10 60B9 6BB8 292E 829B 7249 AED4 1CC1 93B7 01E2"))))
(channel
(name 'nonguix)
(url "https://gitlab.com/nonguix/nonguix")
;; Enable signature verification:
(introduction
(make-channel-introduction
"897c1a470da759236cc11798f4e0a5f7d4d59fbc"
(openpgp-fingerprint
"2A39 3FFF 68F4 EF7A 3D29 12AF 6F51 20A0 22FB B2D5"))))
%default-channels)
What is a Guix channel?
A channel is roughly the Guix equivalent of the AUR or container registries. It's a software repository providing Guix package and service definitions.
Contributing
All contributions are welcome. If you have commit access please remember to setup the authentication hook with
guix git authenticate --cache-key=channels/guix-compose --stats 770b90897bde036329bdb325e5eb1c16c34e985d "8D10 60B9 6BB8 292E 829B 7249 AED4 1CC1 93B7 01E2"
License
Unless otherwise stated all the files in this repository are to be considered under the GPL 3.0 terms. You are more than welcome to open issues or send patches.