Salut Tanguy, I don't know if my method is in line with the correcr way, but you can find inspiration from:
Https://gitlab.com/edouardklein/guix/-/blob/beaverlabs/beaver/packages/python-xyz.scm?ref_type=heads#L884 To the end of the file. To deploy a website I create a few services; A user and group, an activation service for the website's data dirs, a shepherd service (two here, because there are two apps running concurrently), and extensions to nginx and to the profile to add the package. Its quite a lot of boilerplate, but it works quite nicely. You can look at https://gitlab.com/edouardklein/guix/-/blob/beaverlabs/beaver/packages/python-xyz.scm?ref_type=heads#L147 Also, but this one is not online anymore. Please let me know if you hit any roadblock. Medecinsengreve.fr is currently online, so this is workong, feel free to pillage the shepherd service code. I did not have the time to compare my code and yours to see where the difference laid. Le 20 janvier 2026 18:08:16 GMT+01:00, Tanguy Le Carrour <[email protected]> a écrit : >Hi Guix, > >I have a bunch of web services, written in Python using Flask, and I would >love to run them as Guix services, but I cannot figure out how to make that >work!? >The only example I could put my hands on is `patchwork-service-type`, but it’s >different for it provides its own script to run the web server, >`patchwork-admin`. > >My web services follow the WSGI specification and can be run using different >servers (`uwsgi`, `gunicorn`…) so, to me, it’s up to the person starting >the service, and writing the service definition, to pick one and run it. > >I’ve tried several different approaches, but always end up with something >broken. >With my last attempt (below) the service runs, but cannot find `Flask` which >is a `propagated-inputs` of the `gertrude` package. > >```scheme >(define (gertrude-shepherd-service config) > (match-record config <gertrude-configuration> > (address port workers data-source-name user group log-file) > (list > (shepherd-service > (documentation "Run a @code{gertrude} instance.") > (provision '(gertrude)) > (requirement '(networking)) > (start #~(make-forkexec-constructor > (list > (string-append #$gunicorn "/bin/gunicorn") > (string-append "--access-logfile=-") > (string-append "--workers=" (number->string #$workers)) > (string-append "--bind=" #$address ":" (number->string > #$port)) > "gertrude.configuration:wsgi()") > #:user #$user > #:group #$group > #:log-file #$log-file > #:environment-variables (list > (string-append "PYTHONPATH=" #$(file-append gertrude > (string-append > "/lib/python" > (version-major+minor > (package-version python)) > "/site-packages/"))) > (string-append "DSN=" #$data-source-name)))) > (stop #~(make-kill-destructor)))))) >``` > >The only way I’ve found to make `gunicorn` "see" `gertrude` is by modifying >the `PYTHONPATH`. This works, but it doesn’t see the package >`propagated-inputs`. >I don’t feel like adding all the package dependencies to the `PYTHONPATH` >is the proper way to solve the problem, right? > >Am I missing something obvious?! > >-- >Tanguy >
