From: "Ludovic Courtès" <ludo@gnu.org>
To: Alexandru-Sergiu Marton <brown121407@posteo.ro>
Cc: 44099-done@debbugs.gnu.org
Subject: bug#44099: [PATCH] gnu: Add gmnisrv.
Date: Tue, 27 Oct 2020 17:36:02 +0100 [thread overview]
Message-ID: <875z6v7hjh.fsf@gnu.org> (raw)
In-Reply-To: <20201020191738.30054-1-brown121407@posteo.ro> (Alexandru-Sergiu Marton's message of "Tue, 20 Oct 2020 22:17:38 +0300")
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’.
prev parent reply other threads:[~2020-10-27 16:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-20 19:17 [bug#44099] [PATCH] gnu: Add gmnisrv Alexandru-Sergiu Marton
2020-10-24 23:19 ` [bug#44099] [PATCH] services: Add gmnisrv web service Alexandru-Sergiu Marton
2020-10-27 16:36 ` Ludovic Courtès [this message]
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=875z6v7hjh.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=44099-done@debbugs.gnu.org \
--cc=brown121407@posteo.ro \
/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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
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).