GNU bug report logs -
#44099
[PATCH] gnu: Add gmnisrv.
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 44099 in the body.
You can then email your comments to 44099 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
guix-patches <at> gnu.org
:
bug#44099
; Package
guix-patches
.
(Tue, 20 Oct 2020 16:18:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Alexandru-Sergiu Marton <brown121407 <at> posteo.ro>
:
New bug report received and forwarded. Copy sent to
guix-patches <at> gnu.org
.
(Tue, 20 Oct 2020 16:18:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
* 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 <at> tourbillion-technology.com>
;;; Copyright © 2020 Michael Rohleder <mike <at> rohleder.de>
;;; Copyright © 2020 Ryan Prior <rprior <at> protonmail.com>
+;;; Copyright © 2020 Alexandru-Sergiu Marton <brown121407 <at> 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
Information forwarded
to
guix-patches <at> gnu.org
:
bug#44099
; Package
guix-patches
.
(Sat, 24 Oct 2020 20:20:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 44099 <at> debbugs.gnu.org (full text, mbox):
* 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.
---
doc/guix.texi | 35 +++++++++++++++++++++
gnu/services/web.scm | 73 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 108 insertions(+)
diff --git a/doc/guix.texi b/doc/guix.texi
index b5061877e2..83e61aa374 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -81,6 +81,7 @@ Copyright @copyright{} 2020 R Veera Kumar@*
Copyright @copyright{} 2020 Pierre Langlois@*
Copyright @copyright{} 2020 pinoaffe@*
Copyright @copyright{} 2020 André Batista@*
+Copyright @copyright{} 2020 Alexandru-Sergiu Marton@*
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -23357,6 +23358,40 @@ Thus, make sure to add @code{nss-certs} or another certificate package to the
more information on X.509 certificates.
@end quotation
+@subsubheading gmnisrv
+
+@cindex gmnisrv
+The @uref{https://git.sr.ht/~sircmpwn/gmnisrv, gmnisrv} program is a
+simple @uref{https://gemini.circumlunar.space/, Gemini} protocol server.
+
+@deffn {Scheme Variable} gmnisrv-service-type
+This is the type of the gmnisrv service, whose value should be a
+@code{gmnisrv-configuration} object, as in this example:
+
+@lisp
+(service gmnisrv-service-type
+ (gmnisrv-configuration
+ (config-file (local-file "./my-gmnisrv.ini"))))
+@end lisp
+@end deffn
+
+@deftp {Data Type} gmnisrv-configuration
+Data type representing the configuration of gmnisrv.
+
+@table @asis
+@item @code{package} (default: @var{gmnisrv})
+Package object of the gmnisrv server.
+
+@item @code{config-file} (default: @code{%default-gmnisrv-config-file})
+File-like object of the gmnisrv configuration file to use. The default
+configuration listens on port 1965 and serves files from
+@file{/srv/gemini}. Certificates are stored in
+@file{/var/lib/gemini/certs}. For more information, run @command{man
+gmnisrv} and @command{man gmnisrv.ini}.
+
+@end table
+@end deftp
+
@node Certificate Services
@subsection Certificate Services
diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index a74c6c54b4..69465d8ba6 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -14,6 +14,7 @@
;;; Copyright © 2020 Tobias Geerinckx-Rice <me <at> tobias.gr>
;;; Copyright © 2020 Arun Isaac <arunisaac <at> systemreboot.net>
;;; Copyright © 2020 Oleg Pykhalov <go.wigust <at> gmail.com>
+;;; Copyright © 2020 Alexandru-Sergiu Marton <brown121407 <at> posteo.ro>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -1798,3 +1799,75 @@ WSGIPassAuthorization On
"Run Mumi, a Web interface to the Debbugs bug-tracking server.")
(default-value
(mumi-configuration))))
+
+(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")))
+ (stop #~(make-kill-destructor)))))))
+
+(define %gmnisrv-accounts
+ (list (user-group (name "gmnisrv") (system? #t))
+ (user-account
+ (name "gmnisrv")
+ (group "gmnisrv")
+ (system? #t)
+ (comment "gmnisrv Gemini server")
+ (home-directory "/var/empty")
+ (shell (file-append shadow "/sbin/nologin")))))
+
+(define %gmnisrv-activation
+ (with-imported-modules '((guix build utils))
+ #~(begin
+ (use-modules (guix build utils))
+
+ (mkdir-p "/var/lib/gemini/certs")
+ (let* ((pw (getpwnam "gmnisrv"))
+ (uid (passwd:uid pw))
+ (gid (passwd:gid pw)))
+ (chown "/var/lib/gemini" uid gid)
+ (chown "/var/lib/gemini/certs" uid gid)))))
+
+(define gmnisrv-service-type
+ (service-type
+ (name 'guix)
+ (extensions
+ (list (service-extension activation-service-type
+ (const %gmnisrv-activation))
+ (service-extension account-service-type
+ (const %gmnisrv-accounts))
+ (service-extension shepherd-root-service-type
+ gmnisrv-shepherd-service)))
+ (description
+ "Run the gmnisrv Gemini server.")
+ (default-value
+ (gmnisrv-configuration))))
--
2.28.0
Reply sent
to
Ludovic Courtès <ludo <at> gnu.org>
:
You have taken responsibility.
(Tue, 27 Oct 2020 16:37:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Alexandru-Sergiu Marton <brown121407 <at> posteo.ro>
:
bug acknowledged by developer.
(Tue, 27 Oct 2020 16:37:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 44099-done <at> debbugs.gnu.org (full text, mbox):
Hi,
Alexandru-Sergiu Marton <brown121407 <at> 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’.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 25 Nov 2020 12:24:11 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 153 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.