unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: nly <nly@disroot.org>
To: help-guix@gnu.org
Subject: Adding Services
Date: Wed, 08 May 2019 11:53:54 +0530	[thread overview]
Message-ID: <87imuljwg5.fsf@disroot.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 338 bytes --]


I imagine a user(me) would do:

(service (oddmuse-service-type
          (oddmuse-configuration
           (inherit %oddmuse-configuration)
           (root "blah")
           (...))))

Is this alright? Oddmuse package is in (gnu packages web)
I am missing the service extensions, (i don't get what i need to put in
there)

Thanks
Amar


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-Add-oddmuse-service-type.patch --]
[-- Type: text/x-patch, Size: 3420 bytes --]

From 3af150b5220fc40407c2e63eab1019afef303844 Mon Sep 17 00:00:00 2001
From: Amar Singh <nly@disroot.org>
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 <nly@disroot.org>
+;;;
+;;; 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 <http://www.gnu.org/licenses/>.
+
+(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


             reply	other threads:[~2019-05-08  6:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-08  6:23 nly [this message]
2019-05-08 13:57 ` Adding Services John Soo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87imuljwg5.fsf@disroot.org \
    --to=nly@disroot.org \
    --cc=help-guix@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).