From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id kEczIlxOmF+QGgAA0tVLHw (envelope-from ) for ; Tue, 27 Oct 2020 16:44:12 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id wL4hHlxOmF8XcQAA1q6Kng (envelope-from ) for ; Tue, 27 Oct 2020 16:44:12 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 1CCE69402DD for ; Tue, 27 Oct 2020 16:44:12 +0000 (UTC) Received: from localhost ([::1]:40514 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXS4w-0004HJ-Qq for larch@yhetil.org; Tue, 27 Oct 2020 12:44:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52056) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXRy5-0004pm-ER for guix-patches@gnu.org; Tue, 27 Oct 2020 12:37:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:33983) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kXRy2-0002Ly-HQ for guix-patches@gnu.org; Tue, 27 Oct 2020 12:37:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kXRy2-0007Ft-FU for guix-patches@gnu.org; Tue, 27 Oct 2020 12:37:02 -0400 Subject: bug#44099: [PATCH] gnu: Add gmnisrv. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-To: guix-patches@gnu.org Resent-Date: Tue, 27 Oct 2020 16:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 44099 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Alexandru-Sergiu Marton Cc: 44099-done@debbugs.gnu.org Mail-Followup-To: 44099@debbugs.gnu.org, ludo@gnu.org, brown121407@posteo.ro Received: via spool by 44099-done@debbugs.gnu.org id=D44099.160381657527820 (code D ref 44099); Tue, 27 Oct 2020 16:37:02 +0000 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: Ludovic =?UTF-8?Q?Court=C3=A8s?= 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -3.3 (---) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: -1.51 X-TUID: PBE3PGI5CCze 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.