all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Adding Services
@ 2019-05-08  6:23 nly
  2019-05-08 13:57 ` John Soo
  0 siblings, 1 reply; 2+ messages in thread
From: nly @ 2019-05-08  6:23 UTC (permalink / raw)
  To: help-guix

[-- 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: Adding Services
  2019-05-08  6:23 Adding Services nly
@ 2019-05-08 13:57 ` John Soo
  0 siblings, 0 replies; 2+ messages in thread
From: John Soo @ 2019-05-08 13:57 UTC (permalink / raw)
  To: nly; +Cc: help-guix

Hi Amar,

I recommend reading the manual sections on service definitions. I think that will clear up any confusion. For this configuration there are two suggestions I have:

  - closely check the way the `service` procedure is used. It takes the service type and a configuration like below. It is not valid to apply the type to the configuration.

(service oddmuse-service-type
  (oddmuse-configuration ...))

  - The configuration need not use `inherit` if you intend to take the defaults. The record type’s defaults will be used already when using the construction procedure. The configuration would look like this:

(oddmuse-configuration
  (root “blah”)
   ...)

Hope that helps.

- John

> On May 7, 2019, at 11:23 PM, nly <nly@disroot.org> wrote:
> 
> 
> 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
> 
> <0001-gnu-Add-oddmuse-service-type.patch>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-05-08 13:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-08  6:23 Adding Services nly
2019-05-08 13:57 ` John Soo

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.