emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#44099: closed ([PATCH] gnu: Add gmnisrv.)


From: GNU bug Tracking System
Subject: bug#44099: closed ([PATCH] gnu: Add gmnisrv.)
Date: Tue, 27 Oct 2020 16:37:02 +0000

Your message dated Tue, 27 Oct 2020 17:36:02 +0100
with message-id <875z6v7hjh.fsf@gnu.org>
and subject line Re: [bug#44099] [PATCH] gnu: Add gmnisrv.
has caused the debbugs.gnu.org bug report #44099,
regarding [PATCH] gnu: Add gmnisrv.
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
44099: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=44099
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: [PATCH] gnu: Add gmnisrv. Date: Tue, 20 Oct 2020 22:17:38 +0300
* gnu/packages/web.scm (gmnisrv): New variable.
---
 gnu/packages/web.scm | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index 5be95e4741..2ce3ab89bf 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -46,6 +46,7 @@
 ;;; Copyright © 2020 Paul Garlick <pgarlick@tourbillion-technology.com>
 ;;; Copyright © 2020 Michael Rohleder <mike@rohleder.de>
 ;;; Copyright © 2020 Ryan Prior <rprior@protonmail.com>
+;;; Copyright © 2020 Alexandru-Sergiu Marton <brown121407@posteo.ro>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -128,6 +129,7 @@
   #:use-module (gnu packages lisp-xyz)
   #:use-module (gnu packages lsof)
   #:use-module (gnu packages lua)
+  #:use-module (gnu packages man)
   #:use-module (gnu packages markup)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages networking)
@@ -7702,3 +7704,44 @@ solution for any project's interface needs:
 @item Easily integrated and extensible with Python or Lua scripting.
 @end itemize\n")
     (license license:expat)))
+
+(define-public gmnisrv
+  (let ((commit "a22bec51494a50c044416d469cc33e043480e7fd"))
+    (package
+      (name "gmnisrv")
+      (version (git-version "0" "0" commit))
+      (home-page "https://git.sr.ht/~sircmpwn/gmnisrv";)
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url home-page)
+                      (commit commit)))
+                (sha256
+                 (base32
+                  "1k1n7cqd37jgbhxyh231bagdxdxqwpr6n5pk3gax2516w6xbzlb9"))
+                (file-name (git-file-name name version))))
+      (build-system gnu-build-system)
+      (arguments
+       `(#:phases
+         (modify-phases %standard-phases
+           (add-before 'configure 'set-variables
+             (lambda _
+               (setenv "CC" "gcc")
+               #t))
+           (delete 'check)
+           (add-after 'install 'install-config
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let ((etc (string-append (assoc-ref outputs "out")
+                                         "/etc")))
+                 (mkdir-p etc)
+                 (copy-file "config.ini" (string-append etc "/gmnisrv.ini"))
+                 #t))))))
+      (inputs
+       `(("openssl" ,openssl)))
+      (native-inputs
+       `(("pkg-config" ,pkg-config)
+         ("scdoc" ,scdoc)))
+      (synopsis "Simple Gemini protocol server")
+      (description "gmnisrv is a simple Gemini protocol server written in C.")
+      (license (list license:gpl3
+                     license:bsd-3))))) ;; for ini.c and ini.h
-- 
2.28.0




--- End Message ---
--- Begin Message --- Subject: Re: [bug#44099] [PATCH] gnu: Add gmnisrv. Date: Tue, 27 Oct 2020 17:36:02 +0100 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Hi,

Alexandru-Sergiu Marton <brown121407@posteo.ro> skribis:

> * gnu/packages/web.scm (gmnisrv): New variable.

[...]

> +      (synopsis "Simple Gemini protocol server")
> +      (description "gmnisrv is a simple Gemini protocol server written in 
> C.")
> +      (license (list license:gpl3

It’s ‘gpl3+’ since there’s nothing saying “version 3 only”.

> * gnu/services/web.scm (<gmnisrv-configuration>): New record type.
> (%default-gmnisrv-config-file): New variable.
> (%gmnisrv-accounts, %gmnisrv-activation): New variables.
> (gmnisrv-shepherd-service): New procedure.
> (gmnisrv-service-type): New variable.
> * doc/guix.texi (Web Services): Document it.

Nice, applied!

> +(define %default-gmnisrv-config-file
> +  (plain-file "gmnisrv.ini" "
> +listen=0.0.0.0:1965 [::]:1965
> +
> +[:tls]
> +store=/var/lib/gemini/certs
> +
> +organization=gmnisrv on Guix user
> +
> +[localhost]
> +root=/srv/gemini
> +"))
> +
> +(define-record-type* <gmnisrv-configuration>
> +  gmnisrv-configuration make-gmnisrv-configuration
> +  gmnisrv-configuration?
> +  (package     gmnisrv-configuration-package
> +               (default gmnisrv))
> +  (config-file gmnisrv-configuration-config-file
> +               (default %default-gmnisrv-config-file)))
> +
> +(define gmnisrv-shepherd-service
> +  (match-lambda
> +    (($ <gmnisrv-configuration> package config-file)
> +     (list (shepherd-service
> +            (provision '(gmnisrv))
> +            (requirement '(networking))
> +            (documentation "Run the gmnisrv Gemini server.")
> +            (start (let ((gmnisrv (file-append package "/bin/gmnisrv")))
> +                     #~(make-forkexec-constructor
> +                        (list #$gmnisrv "-C" #$config-file)
> +                        #:user "gmnisrv" #:group "gmnisrv"
> +                        #:log-file "/var/log/gmnisrv.log")))

Suggestions for future work.  :-)

  1. We could provide “bindings” to the config file, using
     ‘define-configuration’ for instance, which has direct mapping to
     the ini file format.

  2. Then we could probably use ‘make-forkexec-constructor/container’ to
     run the process in a namespace that contains just what’s needed:
     the root of the files to be served, and the relevant /gnu/store
     bits.

Thanks!

Ludo’.


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]