all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#46513] [PATCH 0/6] Add Agate Gemini server.
@ 2021-02-14 18:51 Alexandru-Sergiu Marton
  2021-02-14 18:57 ` [bug#46513] [PATCH 1/6] gnu: Add rust-rustls-0.19 Alexandru-Sergiu Marton
  2021-02-15 12:42 ` bug#46513: [PATCH 0/6] Add Agate Gemini server Nicolas Goaziou
  0 siblings, 2 replies; 8+ messages in thread
From: Alexandru-Sergiu Marton @ 2021-02-14 18:51 UTC (permalink / raw)
  To: 46513; +Cc: Alexandru-Sergiu Marton

Hi,

These patches add the package for the Agate server for the Gemini protocol as
well as a service and a little documentation in the manual regarding the
configuration of the service.

Alexandru-Sergiu Marton (6):
  gnu: Add rust-rustls-0.19.
  gnu: rust-tokio-macros-1: Update to 1.1.0.
  gnu: rust-tokio-1: Update to 1.2.0.
  gnu: Add rust-tokio-rustls-0.22.
  gnu: Add agate.
  services: Add agate web service.

 doc/guix.texi              |  89 ++++++++++++++++++++++++++++-
 gnu/packages/crates-io.scm |  83 ++++++++++++++++++++++-----
 gnu/packages/rust-apps.scm |  38 +++++++++++++
 gnu/services/web.scm       | 112 ++++++++++++++++++++++++++++++++++++-
 4 files changed, 304 insertions(+), 18 deletions(-)

-- 
2.30.0





^ permalink raw reply	[flat|nested] 8+ messages in thread

* [bug#46513] [PATCH 1/6] gnu: Add rust-rustls-0.19.
  2021-02-14 18:51 [bug#46513] [PATCH 0/6] Add Agate Gemini server Alexandru-Sergiu Marton
@ 2021-02-14 18:57 ` Alexandru-Sergiu Marton
  2021-02-14 18:57   ` [bug#46513] [PATCH 2/6] gnu: rust-tokio-macros-1: Update to 1.1.0 Alexandru-Sergiu Marton
                     ` (4 more replies)
  2021-02-15 12:42 ` bug#46513: [PATCH 0/6] Add Agate Gemini server Nicolas Goaziou
  1 sibling, 5 replies; 8+ messages in thread
From: Alexandru-Sergiu Marton @ 2021-02-14 18:57 UTC (permalink / raw)
  To: 46513; +Cc: Alexandru-Sergiu Marton

* gnu/packages/crates-io.scm (rust-rustls-0.19): New variable.
---
 gnu/packages/crates-io.scm | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index a5ea75a594..124a607e86 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -14,6 +14,7 @@
 ;;; Copyright © 2020 Antoine Côté <antoine.cote@posteo.net>
 ;;; Copyright © 2021 aecepoglu <aecepoglu@fastmail.fm>
 ;;; Copyright @ 2021 Zheng Junjie <873216071@qq.com>
+;;; Copyright © 2021 Alexandru-Sergiu Marton <brown121407@posteo.ro>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -33794,6 +33795,36 @@ rustc compiler.")
      "Automatically apply the suggestions made by rustc.")
     (license (list license:expat license:asl2.0))))
 
+(define-public rust-rustls-0.19
+  (package
+    (name "rust-rustls")
+    (version "0.19.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (crate-uri "rustls" version))
+       (file-name
+        (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32
+         "02wqas2pcxk75s9l9c9f1r5am7258bmqprh68pnqfvkwz0gx4kq6"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:skip-build? #t
+       #:cargo-inputs
+       (("rust-base64" ,rust-base64-0.13)
+        ("rust-log" ,rust-log-0.4)
+        ("rust-ring" ,rust-ring-0.16)
+        ("rust-sct" ,rust-sct-0.6)
+        ("rust-webpki" ,rust-webpki-0.21))))
+    (home-page "https://github.com/ctz/rustls")
+    (synopsis
+     "Modern TLS library written in Rust")
+    (description
+     "This package provides a modern TLS library written in Rust.")
+    (license
+     (list license:asl2.0 license:isc license:expat))))
+
 (define-public rust-rustls-0.18
   (package
     (name "rust-rustls")
-- 
2.30.0





^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [bug#46513] [PATCH 2/6] gnu: rust-tokio-macros-1: Update to 1.1.0.
  2021-02-14 18:57 ` [bug#46513] [PATCH 1/6] gnu: Add rust-rustls-0.19 Alexandru-Sergiu Marton
@ 2021-02-14 18:57   ` Alexandru-Sergiu Marton
  2021-02-14 18:57   ` [bug#46513] [PATCH 3/6] gnu: rust-tokio-1: Update to 1.2.0 Alexandru-Sergiu Marton
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Alexandru-Sergiu Marton @ 2021-02-14 18:57 UTC (permalink / raw)
  To: 46513; +Cc: Alexandru-Sergiu Marton

* gnu/packages/crates-io.scm (rust-tokio-macros-1): Update to 1.1.0.
---
 gnu/packages/crates-io.scm | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index 124a607e86..63346f835d 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -41944,17 +41944,18 @@ futures efficiently")
 (define-public rust-tokio-macros-1
   (package
     (name "rust-tokio-macros")
-    (version "1.0.0")
+    (version "1.1.0")
     (source
      (origin
        (method url-fetch)
        (uri (crate-uri "tokio-macros" version))
        (file-name (string-append name "-" version ".tar.gz"))
        (sha256
-        (base32 "150l6wfcqw2rcjaf22qk3z6ca794x0s2c68n5ar18cfafllpsla2"))))
+        (base32
+         "0mys5zm2gcdgc0iq8nqipzn703q26x1bpw59m04shikgacdb3xya"))))
     (build-system cargo-build-system)
     (arguments
-     `(#:tests? #false                  ;FIXME: undeclared type `tokio`
+     `(#:skip-build? #t
        #:cargo-inputs
        (("rust-proc-macro2" ,rust-proc-macro2-1)
         ("rust-quote" ,rust-quote-1)
-- 
2.30.0





^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [bug#46513] [PATCH 3/6] gnu: rust-tokio-1: Update to 1.2.0.
  2021-02-14 18:57 ` [bug#46513] [PATCH 1/6] gnu: Add rust-rustls-0.19 Alexandru-Sergiu Marton
  2021-02-14 18:57   ` [bug#46513] [PATCH 2/6] gnu: rust-tokio-macros-1: Update to 1.1.0 Alexandru-Sergiu Marton
@ 2021-02-14 18:57   ` Alexandru-Sergiu Marton
  2021-02-14 18:57   ` [bug#46513] [PATCH 4/6] gnu: Add rust-tokio-rustls-0.22 Alexandru-Sergiu Marton
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Alexandru-Sergiu Marton @ 2021-02-14 18:57 UTC (permalink / raw)
  To: 46513; +Cc: Alexandru-Sergiu Marton

* gnu/packages/crates-io.scm (rust-tokio-1): Update to 1.2.0.
---
 gnu/packages/crates-io.scm | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index 63346f835d..c3d44fd1b1 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -41504,17 +41504,18 @@ Fireball''.")
 (define-public rust-tokio-1
   (package
     (name "rust-tokio")
-    (version "1.0.1")
+    (version "1.2.0")
     (source
      (origin
        (method url-fetch)
        (uri (crate-uri "tokio" version))
        (file-name (string-append name "-" version ".tar.gz"))
        (sha256
-        (base32 "1gd6qc9xvm568kicbkch40kjn5w0q2nsn527gcy80v3baqgj4n6j"))))
+        (base32
+         "0fmfykdp29hjq5264mp6sa4c0wp5mlimbi0dd9mrxsk5qq20s6g8"))))
     (build-system cargo-build-system)
     (arguments
-     `(#:tests? #false                  ;FIXME: unresolved import
+     `(#:skip-build? #t
        #:cargo-inputs
        (("rust-autocfg" ,rust-autocfg-1)
         ("rust-bytes" ,rust-bytes-1)
@@ -41528,15 +41529,7 @@ Fireball''.")
         ("rust-signal-hook-registry" ,rust-signal-hook-registry-1)
         ("rust-tokio-macros" ,rust-tokio-macros-1)
         ("rust-tracing" ,rust-tracing-0.1)
-        ("rust-winapi" ,rust-winapi-0.3))
-       #:cargo-development-inputs
-       (("rust-async-stream" ,rust-async-stream-0.3)
-        ("rust-futures" ,rust-futures-0.3)
-        ("rust-loom" ,rust-loom-0.4)
-        ("rust-nix" ,rust-nix-0.19)
-        ("rust-proptest" ,rust-proptest-0.10)
-        ("rust-tokio-stream" ,rust-tokio-stream-0.1)
-        ("rust-tokio-test" ,rust-tokio-test-0.4))))
+        ("rust-winapi" ,rust-winapi-0.3))))
     (home-page "https://tokio.rs")
     (synopsis "Event-driven, non-blocking I/O platform")
     (description
-- 
2.30.0





^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [bug#46513] [PATCH 4/6] gnu: Add rust-tokio-rustls-0.22.
  2021-02-14 18:57 ` [bug#46513] [PATCH 1/6] gnu: Add rust-rustls-0.19 Alexandru-Sergiu Marton
  2021-02-14 18:57   ` [bug#46513] [PATCH 2/6] gnu: rust-tokio-macros-1: Update to 1.1.0 Alexandru-Sergiu Marton
  2021-02-14 18:57   ` [bug#46513] [PATCH 3/6] gnu: rust-tokio-1: Update to 1.2.0 Alexandru-Sergiu Marton
@ 2021-02-14 18:57   ` Alexandru-Sergiu Marton
  2021-02-14 18:57   ` [bug#46513] [PATCH 5/6] gnu: Add agate Alexandru-Sergiu Marton
  2021-02-14 18:57   ` [bug#46513] [PATCH 6/6] services: Add agate web service Alexandru-Sergiu Marton
  4 siblings, 0 replies; 8+ messages in thread
From: Alexandru-Sergiu Marton @ 2021-02-14 18:57 UTC (permalink / raw)
  To: 46513; +Cc: Alexandru-Sergiu Marton

* gnu/packages/crates-io.scm (rust-tokio-rustls-0.22): New variable.
---
 gnu/packages/crates-io.scm | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index c3d44fd1b1..adb588a5ef 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -42302,6 +42302,34 @@ servers.")
      "Event loop that drives Tokio I/O resources.")
     (license license:expat)))
 
+(define-public rust-tokio-rustls-0.22
+  (package
+    (name "rust-tokio-rustls")
+    (version "0.22.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (crate-uri "tokio-rustls" version))
+       (file-name
+        (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32
+         "1dp1s2kai081f3fn9gjq92x2lw7lm7iqpcsl02cg2zg5fbg48s5w"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:skip-build? #t
+       #:cargo-inputs
+       (("rust-rustls" ,rust-rustls-0.19)
+        ("rust-tokio" ,rust-tokio-1)
+        ("rust-webpki" ,rust-webpki-0.21))))
+    (home-page "https://github.com/tokio-rs/tls")
+    (synopsis
+     "Asynchronous TLS/SSL streams for Tokio")
+    (description
+     "This package provides asynchronous TLS/SSL streams for Tokio using
+Rustls.")
+    (license (list license:expat license:asl2.0))))
+
 (define-public rust-tokio-rustls-0.14
   (package
     (name "rust-tokio-rustls")
-- 
2.30.0





^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [bug#46513] [PATCH 5/6] gnu: Add agate.
  2021-02-14 18:57 ` [bug#46513] [PATCH 1/6] gnu: Add rust-rustls-0.19 Alexandru-Sergiu Marton
                     ` (2 preceding siblings ...)
  2021-02-14 18:57   ` [bug#46513] [PATCH 4/6] gnu: Add rust-tokio-rustls-0.22 Alexandru-Sergiu Marton
@ 2021-02-14 18:57   ` Alexandru-Sergiu Marton
  2021-02-14 18:57   ` [bug#46513] [PATCH 6/6] services: Add agate web service Alexandru-Sergiu Marton
  4 siblings, 0 replies; 8+ messages in thread
From: Alexandru-Sergiu Marton @ 2021-02-14 18:57 UTC (permalink / raw)
  To: 46513; +Cc: Alexandru-Sergiu Marton

* gnu/packages/rust-apps.scm (agate): New variable.
---
 gnu/packages/rust-apps.scm | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/gnu/packages/rust-apps.scm b/gnu/packages/rust-apps.scm
index 9511cbf308..b832bd4453 100644
--- a/gnu/packages/rust-apps.scm
+++ b/gnu/packages/rust-apps.scm
@@ -10,6 +10,7 @@
 ;;; Copyright © 2021 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2021 Sharlatan Hellseher <sharlatanus@gmail.ccom>
 ;;; Copyright © 2021 Zheng Junjie <873216071@qq.com>
+;;; Copyright © 2021 Alexandru-Sergiu Marton <brown121407@posteo.ro>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -43,6 +44,43 @@
   #:use-module (gnu packages tls)
   #:use-module (gnu packages version-control))
 
+(define-public agate
+  (package
+    (name "agate")
+    (version "2.4.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (crate-uri "agate" version))
+       (file-name
+        (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32
+         "19szg91l4r76vrc44hifrqvk38c5q21hbycgi62bcb52rswgwgdk"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:cargo-inputs
+       (("rust-env-logger" ,rust-env-logger-0.8)
+        ("rust-getopts" ,rust-getopts-0.2)
+        ("rust-log" ,rust-log-0.4)
+        ("rust-mime-guess" ,rust-mime-guess-2)
+        ("rust-once-cell" ,rust-once-cell-1)
+        ("rust-percent-encoding"
+         ,rust-percent-encoding-2)
+        ("rust-rustls" ,rust-rustls-0.19)
+        ("rust-tokio" ,rust-tokio-1)
+        ("rust-tokio-rustls" ,rust-tokio-rustls-0.22)
+        ("rust-url" ,rust-url-2))))
+    (home-page "gemini://qwertqwefsday.eu/agate.gmi")
+    (synopsis
+     "Very simple server for the Gemini hypertext protocol")
+    (description
+     "Agate is a server for the Gemini network protocol, built with the Rust
+programming language.  It has very few features, and can only serve static
+files.  It uses async I/O, and should be quite efficient even when running on
+low-end hardware and serving many concurrent requests.")
+    (license (list license:expat license:asl2.0))))
+
 (define-public bat
   (package
     (name "bat")
-- 
2.30.0





^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [bug#46513] [PATCH 6/6] services: Add agate web service.
  2021-02-14 18:57 ` [bug#46513] [PATCH 1/6] gnu: Add rust-rustls-0.19 Alexandru-Sergiu Marton
                     ` (3 preceding siblings ...)
  2021-02-14 18:57   ` [bug#46513] [PATCH 5/6] gnu: Add agate Alexandru-Sergiu Marton
@ 2021-02-14 18:57   ` Alexandru-Sergiu Marton
  4 siblings, 0 replies; 8+ messages in thread
From: Alexandru-Sergiu Marton @ 2021-02-14 18:57 UTC (permalink / raw)
  To: 46513; +Cc: Alexandru-Sergiu Marton

* gnu/services/web.scm (<agate-configuration>): New record type.
(agate-accounts, agate-shepherd-service): New procedures.
(agate-service-type): New variable.
* doc/guix.texi (Web Services): Document it.
---
 doc/guix.texi        |  89 +++++++++++++++++++++++++++++++++-
 gnu/services/web.scm | 112 ++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 198 insertions(+), 3 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 68abb968b0..c10d6877e2 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -81,7 +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@*
+Copyright @copyright{} 2020, 2021 Alexandru-Sergiu Marton@*
 Copyright @copyright{} 2020 raingloom@*
 Copyright @copyright{} 2020 Daniel Brooks@*
 Copyright @copyright{} 2020 John Soo@*
@@ -25316,6 +25316,93 @@ gmnisrv} and @command{man gmnisrv.ini}.
 @end table
 @end deftp
 
+@subsubheading agate
+
+@cindex agate
+The @uref{gemini://qwertqwefsday.eu/agate.gmi, Agate}
+(@uref{https://github.com/mbrubeck/agate, GitHub page over HTTPS})
+program is a simple @uref{https://gemini.circumlunar.space/, Gemini}
+protocol server written in Rust.
+
+@deffn {Scheme Variable} agate-service-type
+This is the type of the agate service, whose value should be an
+@code{agate-service-type} object, as in this example:
+
+@lisp
+(service agate-service-type
+	 (agate-configuration
+	   (content "/srv/gemini")
+	   (cert "/srv/cert.pem")
+	   (key "/srv/key.rsa")))
+@end lisp
+
+The example above represents the minimal tweaking necessary to get Agate
+up and running. Specifying the path to the certificate and key is always
+necessary, as the Gemini protocol requires TLS by default.
+
+To obtain a certificate and a key, you could, for example, use OpenSSL,
+running a command similar to the following example:
+
+@example
+openssl req -x509 -newkey rsa:4096 -keyout key.rsa -out cert.pem \
+    -days 3650 -nodes -subj "/CN=example.com"
+@end example
+
+Of course, you'll have to replace @i{example.com} with your own domain
+name, and then point the Agate configuration towards the path of the
+generated key and certificate.
+
+@end deffn
+
+@deftp {Data Type} agate-configuration
+Data type representing the configuration of Agate.
+
+@table @asis
+@item @code{package} (default: @var{agate})
+The package object of the Agate server.
+
+@item @code{content} (default: @code{"/srv/gemini"})
+The path of the directory from which Agate will serve files.
+
+@item @code{cert} (default: @code{#f})
+The path to the TLS certificate PEM file to be used for encrypted
+connections. Must be filled in with a value from the user.
+
+@item @code{key} (default: @code{#f})
+The path to the PKCS8 private key file to be used for encrypted
+connections. Must be filled in with a value from the user.
+
+@item @code{addr} (default: @code{'("0.0.0.0:1965" "[::]:1965")})
+A list of the addresses to listen on.
+
+@item @code{hostname} (default: @code{#f})
+The domain name of this Gemini server. Optional.
+
+@item @code{lang} (default: @code{#f})
+RFC 4646 Language code(s) for text/gemini documents. Optional.
+
+@item @code{silent?} (default: @code{#f})
+Set to @code{#t} to disable logging output.
+
+@item @code{serve-secret?} (default: @code{#f})
+Set to @code{#t} to serve secret files (files/directories starting with
+a dot).
+
+@item @code{log-ip?} (default: @code{#t})
+Whether or not to output IP addresses when logging.
+
+@item @code{user} (default: @code{"agate"})
+Owner of the @code{agate} process.
+
+@item @code{group} (default: @code{"agate"})
+Owner's group of the @code{agate} process.
+
+@item @code{log-file} (default: @code{"/var/log/agate.log"})
+The path of the file which should store the logging output of Agate.
+
+@end table
+@end deftp
+
 @node Certificate Services
 @subsection Certificate Services
 
diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index ff7b262b6a..aa688a4328 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -14,7 +14,7 @@
 ;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2020 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2020 Oleg Pykhalov <go.wigust@gmail.com>
-;;; Copyright © 2020 Alexandru-Sergiu Marton <brown121407@posteo.ro>
+;;; Copyright © 2020, 2021 Alexandru-Sergiu Marton <brown121407@posteo.ro>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -50,6 +50,7 @@
   #:use-module (gnu packages guile)
   #:use-module (gnu packages logging)
   #:use-module (gnu packages mail)
+  #:use-module (gnu packages rust-apps)
   #:use-module (guix packages)
   #:use-module (guix records)
   #:use-module (guix modules)
@@ -263,7 +264,25 @@
             gmnisrv-configuration-package
             gmnisrv-configuration-config-file
 
-            gmnisrv-service-type))
+            gmnisrv-service-type
+
+            agate-configuration
+            agate-configuration?
+            agate-configuration-package
+            agate-configuration-content
+            agate-configuration-cert
+            agate-configuration-key
+            agate-configuration-addr
+            agate-configuration-hostname
+            agate-configuration-lang
+            agate-configuration-silent
+            agate-configuration-serve-secret
+            agate-configuration-log-ip
+            agate-configuration-user
+            agate-configuration-group
+            agate-configuration-log-file
+
+            agate-service-type))
 
 ;;; Commentary:
 ;;;
@@ -1885,3 +1904,92 @@ root=/srv/gemini
     "Run the gmnisrv Gemini server.")
    (default-value
      (gmnisrv-configuration))))
+
+(define-record-type* <agate-configuration>
+  agate-configuration make-agate-configuration
+  agate-configuration?
+  (package  agate-configuration-package
+            (default agate))
+  (content  agate-configuration-content
+            (default "/srv/gemini"))
+  (cert     agate-configuration-cert
+            (default #f))
+  (key      agate-configuration-key
+            (default #f))
+  (addr     agate-configuration-addr
+            (default '("0.0.0.0:1965" "[::]:1965")))
+  (hostname agate-configuration-hostname
+            (default #f))
+  (lang     agate-configuration-lang
+            (default #f))
+  (silent?  agate-configuration-silent
+            (default #f))
+  (serve-secret? agate-configuration-serve-secret
+                 (default #f))
+  (log-ip?  agate-configuration-log-ip
+            (default #t))
+  (user     agate-configuration-user
+            (default "agate"))
+  (group    agate-configuration-group
+            (default "agate"))
+  (log-file agate-configuration-log
+            (default "/var/log/agate.log")))
+
+(define agate-shepherd-service
+  (match-lambda
+    (($ <agate-configuration> package content cert key addr
+                              hostname lang silent? serve-secret?
+                              log-ip? user group log-file)
+     (list (shepherd-service
+            (provision '(agate))
+            (requirement '(networking))
+            (documentation "Run the agate Gemini server.")
+            (start (let ((agate (file-append package "/bin/agate")))
+                     #~(make-forkexec-constructor
+			(list #$agate
+			      "--content" #$content
+			      "--cert" #$cert
+			      "--key" #$key
+			      "--addr" #$@addr
+                              #$@(if lang
+                                     (list "--lang" lang)
+                                     '())
+			      #$@(if hostname
+				     (list "--hostname" hostname)
+				     '())
+			      #$@(if silent? '("--silent") '())
+			      #$@(if serve-secret? '("--serve-secret") '())
+			      #$@(if log-ip? '("--log-ip") '()))
+			#:user #$user #:group #$group
+			#:log-file #$log-file)))
+            (stop #~(make-kill-destructor)))))))
+             
+(define agate-accounts
+  (match-lambda
+    (($ <agate-configuration> _ _ _ _ _
+                              _ _ _ _
+                              _ user group _)
+     `(,@(if (equal? group "agate")
+             '()
+             (list (user-group (name "agate") (system? #t))))
+       ,(user-group
+         (name group)
+         (system? #t))
+       ,(user-account
+         (name user)
+         (group group)
+         (supplementary-groups '("agate"))
+         (system? #t)
+         (comment "agate server user")
+         (home-directory "/var/empty")
+         (shell (file-append shadow "/sbin/nologin")))))))
+
+(define agate-service-type
+  (service-type
+   (name 'guix)
+   (extensions
+    (list (service-extension account-service-type
+                             agate-accounts)
+          (service-extension shepherd-root-service-type
+                             agate-shepherd-service)))
+   (default-value (agate-configuration))))
-- 
2.30.0





^ permalink raw reply related	[flat|nested] 8+ messages in thread

* bug#46513: [PATCH 0/6] Add Agate Gemini server.
  2021-02-14 18:51 [bug#46513] [PATCH 0/6] Add Agate Gemini server Alexandru-Sergiu Marton
  2021-02-14 18:57 ` [bug#46513] [PATCH 1/6] gnu: Add rust-rustls-0.19 Alexandru-Sergiu Marton
@ 2021-02-15 12:42 ` Nicolas Goaziou
  1 sibling, 0 replies; 8+ messages in thread
From: Nicolas Goaziou @ 2021-02-15 12:42 UTC (permalink / raw)
  To: Alexandru-Sergiu Marton; +Cc: 46513-done

Hello,

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

> These patches add the package for the Agate server for the Gemini protocol as
> well as a service and a little documentation in the manual regarding the
> configuration of the service.
>
> Alexandru-Sergiu Marton (6):
>   gnu: Add rust-rustls-0.19.
>   gnu: rust-tokio-macros-1: Update to 1.1.0.
>   gnu: rust-tokio-1: Update to 1.2.0.
>   gnu: Add rust-tokio-rustls-0.22.
>   gnu: Add agate.
>   services: Add agate web service.

Thank you!

I applied the patches with the modifications below:

- When adding new version of an existing Rust crate, I made the latter
  inherit from the former.

- I updated agate to 2.5.2, and changed the home-page into an HTTP one
  (i.e., the repository) for practical reasons.

- I fixed typos and wording in the documentation (two spaces after full
  stops, "the path of the file" -> "the file", @var -> @file or @code).

Regards,
-- 
Nicolas Goaziou




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-02-15 12:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-14 18:51 [bug#46513] [PATCH 0/6] Add Agate Gemini server Alexandru-Sergiu Marton
2021-02-14 18:57 ` [bug#46513] [PATCH 1/6] gnu: Add rust-rustls-0.19 Alexandru-Sergiu Marton
2021-02-14 18:57   ` [bug#46513] [PATCH 2/6] gnu: rust-tokio-macros-1: Update to 1.1.0 Alexandru-Sergiu Marton
2021-02-14 18:57   ` [bug#46513] [PATCH 3/6] gnu: rust-tokio-1: Update to 1.2.0 Alexandru-Sergiu Marton
2021-02-14 18:57   ` [bug#46513] [PATCH 4/6] gnu: Add rust-tokio-rustls-0.22 Alexandru-Sergiu Marton
2021-02-14 18:57   ` [bug#46513] [PATCH 5/6] gnu: Add agate Alexandru-Sergiu Marton
2021-02-14 18:57   ` [bug#46513] [PATCH 6/6] services: Add agate web service Alexandru-Sergiu Marton
2021-02-15 12:42 ` bug#46513: [PATCH 0/6] Add Agate Gemini server Nicolas Goaziou

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.