aboutsummaryrefslogtreecommitdiff
path: root/guix/forge/klaus.scm
diff options
context:
space:
mode:
Diffstat (limited to 'guix/forge/klaus.scm')
-rw-r--r--guix/forge/klaus.scm29
1 files changed, 28 insertions, 1 deletions
diff --git a/guix/forge/klaus.scm b/guix/forge/klaus.scm
index ba963ee..54b374f 100644
--- a/guix/forge/klaus.scm
+++ b/guix/forge/klaus.scm
@@ -18,19 +18,22 @@
;;; <https://www.gnu.org/licenses/>.
(define-module (forge klaus)
+ #:use-module (forge gunicorn)
#:use-module ((gnu packages check) #:select (python-nose python-pytest))
#:use-module ((gnu packages python-web)
#:select (python-flask python-werkzeug))
#:use-module ((gnu packages python-xyz)
#:select (python-dulwich python-humanize python-pygments))
#:use-module ((gnu packages version-control) #:select (git-minimal))
+ #:use-module (gnu system file-systems)
#:use-module (guix build-system pyproject)
#:use-module (guix build-system python)
#:use-module (guix download)
#:use-module (guix gexp)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages)
- #:use-module (guix utils))
+ #:use-module (guix utils)
+ #:export (klaus-gunicorn-app))
(define-public python-httpauth
(package
@@ -117,3 +120,27 @@ routes using HTTP Digest Authentication.")
@item Code navigation using Exuberant ctags
@end itemize")
(license license:isc)))
+
+(define* (klaus-gunicorn-app repository-directory sockets
+ #:key site-name)
+ "Return a @code{<gunicorn-app>} object to deploy klaus on
+@var{sockets}, a list of @code{<forge-ip-socket>} or
+@code{<forge-unix-socket>} objects.
+
+@var{repository-directory} is the path to the directory containing git
+repositories to serve.
+
+@var{site-name} is the name of the klaus site to be displayed in the
+banner."
+ (gunicorn-app
+ (name "klaus")
+ (package python-klaus)
+ (wsgi-app-module "klaus.contrib.wsgi_autoreload")
+ (sockets sockets)
+ (environment-variables `(("KLAUS_REPOS_ROOT" . ,repository-directory)
+ ,@(if site-name
+ `(("KLAUS_SITE_NAME" . ,site-name))
+ '())))
+ (mappings (list (file-system-mapping
+ (source repository-directory)
+ (target source))))))