From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 20 12:17:51 2020 Received: (at submit) by debbugs.gnu.org; 20 Oct 2020 16:17:51 +0000 Received: from localhost ([127.0.0.1]:46497 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kUuKZ-00066Z-0X for submit@debbugs.gnu.org; Tue, 20 Oct 2020 12:17:51 -0400 Received: from lists.gnu.org ([209.51.188.17]:53760) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kUuKX-00066S-N6 for submit@debbugs.gnu.org; Tue, 20 Oct 2020 12:17:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42982) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kUuKX-0006vb-G6 for guix-patches@gnu.org; Tue, 20 Oct 2020 12:17:45 -0400 Received: from mout02.posteo.de ([185.67.36.66]:56341) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kUuKS-0006Yr-TS for guix-patches@gnu.org; Tue, 20 Oct 2020 12:17:44 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 6488E2400FB for ; Tue, 20 Oct 2020 18:17:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.ro; s=2017; t=1603210656; bh=q8XkIjZyGnHBIVnGgc8pSBRfY/Omaii/+G4P+V59F4U=; h=From:To:Cc:Subject:Date:From; b=Q80dGQLJnaCRubJuljKb2w0Qna3eZrrGps++x6G0JS4iRr3T3y2HQj9uqSaT8fZyr i4IRao7v+MRgSlsnsk9tf4KSfliMsipFXIxzhCFQHld6/r7JDvST4/tOGWQIFmNOPL Ubz0gbd/+wAXZ0Qs9x6SvXms9yCnD7qveoUMB9fUVDsZWpw+F7TVbXeBDT3DQbPgwL 09W0EgvFDm0UDK6tUlI6Z5t5fKZD//0JnrdNR2U0ckkn//DBr+Qm2MS0DKL6x6DzW7 UPSW7V8rag9b9iQQFTw990XZlZpDTunBJIpRpdaT5bAVcO8heBTvQk0+XwNmD9SoAG VE72txckfr5uw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4CFzL763r1z9rxl; Tue, 20 Oct 2020 18:17:35 +0200 (CEST) From: Alexandru-Sergiu Marton To: guix-patches@gnu.org Subject: [PATCH] gnu: Add gmnisrv. Date: Tue, 20 Oct 2020 22:17:38 +0300 Message-Id: <20201020191738.30054-1-brown121407@posteo.ro> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=185.67.36.66; envelope-from=brown121407@posteo.ro; helo=mout02.posteo.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/20 11:19:24 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit Cc: Alexandru-Sergiu Marton X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) * 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 ;;; Copyright © 2020 Michael Rohleder ;;; Copyright © 2020 Ryan Prior +;;; Copyright © 2020 Alexandru-Sergiu Marton ;;; ;;; 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 From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 24 16:19:46 2020 Received: (at 44099) by debbugs.gnu.org; 24 Oct 2020 20:19:46 +0000 Received: from localhost ([127.0.0.1]:35256 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kWQ0t-0005TB-1U for submit@debbugs.gnu.org; Sat, 24 Oct 2020 16:19:46 -0400 Received: from mout02.posteo.de ([185.67.36.66]:55827) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kWQ0q-0005Sx-Gy for 44099@debbugs.gnu.org; Sat, 24 Oct 2020 16:19:42 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id BE2BE2400FC for <44099@debbugs.gnu.org>; Sat, 24 Oct 2020 22:19:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.ro; s=2017; t=1603570773; bh=nRZwvtFV6S9sbmbH2oRjFmwFrlQL8LTASdybkihPyic=; h=From:To:Cc:Subject:Date:From; b=A2nmKFJxO7mjxdFWNxMZHU7rIExzdDryWdzXwM5knmfvSFHLrONrk5AKGEvoBKfWF LhUg5S/cQfVHiqXMgYQ8hiKEk8o5zLxbtMK6qwxHNpE/qWLdTXACZeEYxRoXERXrXB /t/t4dz1lZhvNXMlS5vARgQheOXGsANd0TAlaxGbtDQaEWcqGRe1q38kfBRi2RNWoP /11ripEQlAgJ3LoProhrbNj212E/Ip+XAoDtI3G8/eQDEKqwkbtKJscBI/996LYvfk zWBo2pGocmTw7LUHpSQ72+SAUX2lKA4yytPc4/Cugj58dTDvmEDnuTxC5KLBj5uv1W pz01d2yYQdroA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4CJXWT03MWz6tmK; Sat, 24 Oct 2020 22:19:32 +0200 (CEST) From: Alexandru-Sergiu Marton To: 44099@debbugs.gnu.org Subject: [PATCH] services: Add gmnisrv web service. Date: Sun, 25 Oct 2020 02:19:39 +0300 Message-Id: <20201024231939.18693-1-brown121407@posteo.ro> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201020191738.30054-1-brown121407@posteo.ro> References: <20201020191738.30054-1-brown121407@posteo.ro> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.3 (/) X-Debbugs-Envelope-To: 44099 Cc: Alexandru-Sergiu Marton X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) * gnu/services/web.scm (): 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 ;;; Copyright © 2020 Arun Isaac ;;; Copyright © 2020 Oleg Pykhalov +;;; Copyright © 2020 Alexandru-Sergiu Marton ;;; ;;; 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 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 + (($ 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 From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 27 12:36:15 2020 Received: (at 44099-done) by debbugs.gnu.org; 27 Oct 2020 16:36:15 +0000 Received: from localhost ([127.0.0.1]:45528 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kXRxH-0007Ee-AQ for submit@debbugs.gnu.org; Tue, 27 Oct 2020 12:36:15 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51696) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kXRxE-0007EN-OR for 44099-done@debbugs.gnu.org; Tue, 27 Oct 2020 12:36:14 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:53903) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXRx7-0002HU-FD; Tue, 27 Oct 2020 12:36:06 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=39936 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kXRx5-0003Al-Om; Tue, 27 Oct 2020 12:36:05 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Alexandru-Sergiu Marton Subject: Re: [bug#44099] [PATCH] gnu: Add gmnisrv. References: <20201020191738.30054-1-brown121407@posteo.ro> Date: Tue, 27 Oct 2020 17:36:02 +0100 In-Reply-To: <20201020191738.30054-1-brown121407@posteo.ro> (Alexandru-Sergiu Marton's message of "Tue, 20 Oct 2020 22:17:38 +0300") Message-ID: <875z6v7hjh.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 44099-done Cc: 44099-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi, Alexandru-Sergiu Marton skribis: > * gnu/packages/web.scm (gmnisrv): New variable. [...] > + (synopsis "Simple Gemini protocol server") > + (description "gmnisrv is a simple Gemini protocol server written i= n C.") > + (license (list license:gpl3 It=E2=80=99s =E2=80=98gpl3+=E2=80=99 since there=E2=80=99s nothing saying = =E2=80=9Cversion 3 only=E2=80=9D. > * gnu/services/web.scm (): 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=3D0.0.0.0:1965 [::]:1965 > + > +[:tls] > +store=3D/var/lib/gemini/certs > + > +organization=3Dgmnisrv on Guix user > + > +[localhost] > +root=3D/srv/gemini > +")) > + > +(define-record-type* > + 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 > + (($ 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 =E2=80=9Cbindings=E2=80=9D to the config file, using =E2=80=98define-configuration=E2=80=99 for instance, which has direct = mapping to the ini file format. 2. Then we could probably use =E2=80=98make-forkexec-constructor/containe= r=E2=80=99 to run the process in a namespace that contains just what=E2=80=99s neede= d: the root of the files to be served, and the relevant /gnu/store bits. Thanks! Ludo=E2=80=99. From unknown Mon Jun 23 13:13:35 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 25 Nov 2020 12:24:11 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator