Dear Guixers,
I was recently inspired from Nix's oci-container feature and wrote a
thin wrapper around the docker CLI to enable the management of docker
containers through Shepherd [0]. This enables handling of non packaged
services through guix system reconfigure and herd start/stop/status .
|(define(grafana-configuration config) | (oci-container-configuration
(image"|grafana/grafana:10.0.1"|)
(network"host")
(ports
`((,port."3000")))
(volumes
`(("/var/lib/grafana"."/var/lib/grafana")
;; Neededbecausegrafana.iniisasymlinktoaniteminthestore.
("/gnu/store"."/gnu/store")
("/etc/grafana/grafana.ini"."/etc/grafana/grafana.ini")))))
(definegrafana-service-type
(service-type(name'grafana)
(extensions(list(service-extensionoci-container-service-type
grafana-configuration)
(service-extensionaccount-service-type
(const%grafana-accounts))
(service-extensionnginx-service-type
grafana-nginx-locations)
(service-extensionactivation-service-type
%grafana-activation)))))
This is somewhat made up code, for a real world example you can have a
look here [1].
In the future it probably makes sense to be able to switch the "OCI
backend" to podman, for now I just wanted to figure out if it's
something that would be useful to the Guix community and if the
implementation looks right.
To conclude, I'm not advocating for adding OCI-backed services to Guix
mainstream: in my opinion they should be bootstrapped and built from
source, but I believe the actual "backend" implementation for such
services could be useful to have in Guix. What do you think?
Thank you for the wonderful community that Guix still proves to be,
giacomo
[0]:
https://gitlab.com/orang3/small-guix/-/blob/master/small-guix/services/docker.scm
[1]:
https://gitlab.com/orang3/guix-nas/-/blob/main/modules/nas/services/grafana.scm