Hello Naranden!
I'm willing to do a similar thing as you but after several trials and
errors I did not managed to get fully satisfactory solution.
So far my working approach was to define a simple service that runs a
"built" container using make-forkexec-constructor (in a simple service).
But this solution lacks to have the built phase controlled by shepherd
(something equivalent of what is achieved with docker-pull). So I need
to manually update the container (if I change its definition or after a
"guix pull" is done in the host) which is not (at all) ideal.
The host service is defined as:
(simple-service
'cont-service shepherd-root-service-type
(list
(shepherd-service
(auto-start? #t)
(documentation "Runs containeraized service")
(provision '(cont-service))
(requirement '(user-processes))
(respawn? #t)
(start
#~(make-forkexec-constructor
'("/path/cont-service-user")))
(stop #~(make-kill-destructor))))))
And to build the container I use:
$ guix system container --network
--share=/path/service_shared_folder=/path/shared
--root=/path/cont-service-user /path/cont-service.scm
(To control the build of the container by shepherd I've tried to include
the last command by defining actions/procedure in the shepherd service
definition, or by running a bash script in make-forkexec-constructor
which contains the guix system container command but I did not manage to
get any positive outcome).
Any comment?
Have you had any progress on your side.?
Best!