>From 3af150b5220fc40407c2e63eab1019afef303844 Mon Sep 17 00:00:00 2001
From: Amar Singh
Date: Sun, 5 May 2019 04:15:13 +0530
Subject: [PATCH] gnu: Add oddmuse-service-type.
* gnu/services/oddmuse.scm (oddmuse-service-type): New variable.
---
gnu/services/oddmuse.scm | 86 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 86 insertions(+)
create mode 100644 gnu/services/oddmuse.scm
diff --git a/gnu/services/oddmuse.scm b/gnu/services/oddmuse.scm
new file mode 100644
index 0000000000..881d795e60
--- /dev/null
+++ b/gnu/services/oddmuse.scm
@@ -0,0 +1,86 @@
+;;; GNU Guix --- Functional package management for GNU
+;;;
+;;; Copyright (C) 2019 by Amar Singh
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see .
+
+(define-module (gnu services oddmuse))
+(use-modules
+ (srfi srfi-1)
+ (guix packages)
+ (gnu packages web)
+ (gnu services)
+ (gnu services web)
+ (gnu services configuration)
+ )
+
+(define (oddmuse-activation config)
+ #t)
+
+(define nginx-server-configuration-list?
+ (@@ (gnu services cgit) nginx-server-configuration-list?))
+
+(define serialize-nginx-server-configuration-list
+ (@@ (gnu services cgit) serialize-nginx-server-configuration-list))
+
+(define-configuration oddmuse-configuration
+ (package
+ (package oddmuse)
+ "The oddmuse package.")
+ (nginx
+ (nginx-server-configuration-list
+ (list %oddmuse-configuration-nginx))
+ "Nginx server config"))
+
+(define-public oddmuse-service-type
+ (service-type
+ (name 'oddmuse)
+ (extensions
+ (list
+ ;; (service-extension activation-service-type
+ ;; oddmuse-activation)
+ (service-extension nginx-service-type
+ oddmuse-configuration-ngnix)
+ (service-extension fcgiwrap-service-type
+ (const #t))))
+ (default-value (oddmuse-configuration))
+ (description
+ "Run the oddmuse web wiki.")))
+
+(define %oddmuse-configuration-nginx
+ (nginx-server-configuration
+ (root "/srv/wiki")
+ (listen '("80"))
+ (server-name "localhost")
+ (locations
+ (list
+ (nginx-location-configuration
+ (uri "~ ^/wiki/index\\.cgi/.*$")
+ (body '(
+ "rewrite ^/wiki/index\\.cgi.*/(.*$) /wiki/index.cgi?$1 permanent;" )))
+ (nginx-location-configuration
+ (uri "~ \\.cgi")
+ (body '(
+ "fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;"
+ "include /etc/nginx/fastcgi_params;"
+ "fastcgi_index index.cgi;"
+ "fastcgi_pass fcgiwrap;"
+ )))))
+ (try-files (list "$uri" "@oddmuse"))
+ (ssl-certificate #f)
+ (ssl-certificate-key #f)))
+
+;;; oddmuse.scm ends here
--
2.21.0