Subject: [PATCH 3/3] gnu: Add ssh-chat.

From: Stefan Reichör <[email-masked]>
Date: Wed, 10 Feb 2021 22:54:04 +0100

* gnu/packages/ssh.scm (ssh-chat): New variable.
---
 gnu/packages/ssh.scm | 47 +++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 46 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/ssh.scm b/gnu/packages/ssh.scm
index 04c8c6ceaa..9e146ea03a 100644
--- a/gnu/packages/ssh.scm
+++ b/gnu/packages/ssh.scm
@@ -7,7 +7,7 @@
 ;;; Copyright © 2016, 2021 Nicolas Goaziou <[email-masked]>
 ;;; Copyright © 2016 Christopher Allan Webber <[email-masked]>
 ;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <[email-masked]>
-;;; Copyright © 2017 Stefan Reichör <[email-masked]>
+;;; Copyright © 2017, 2021 Stefan Reichör <[email-masked]>
 ;;; Copyright © 2017 Ricardo Wurmus <[email-masked]>
 ;;; Copyright © 2017 Nikita <[email-masked]>
 ;;; Copyright © 2018 Manuel Graf <[email-masked]>
@@ -41,6 +41,7 @@
   #:use-module (gnu packages crypto)
   #:use-module (gnu packages elf)
   #:use-module (gnu packages gnupg)
+  #:use-module (gnu packages golang)
   #:use-module (gnu packages gperf)
   #:use-module (gnu packages groff)
   #:use-module (gnu packages guile)
@@ -62,11 +63,13 @@
   #:use-module (gnu packages python-web)
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages readline)
+  #:use-module (gnu packages terminals)
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages xorg)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system go)
   #:use-module (guix build-system python)
   #:use-module (guix download)
   #:use-module (guix git-download)
@@ -915,3 +918,45 @@ Ed25519 keys.
 @item Modern browsers are supported.
 @end itemize")
     (license license:expat)))
+
+(define-public ssh-chat
+  (package
+    (name "ssh-chat")
+    (version "1.10")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/shazow/ssh-chat")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "15avqg9j7yx0cx1dvz46r0ipgqnq5i9lfv9rwy2fjqsy501qx03v"))))
+    (build-system go-build-system)
+    (propagated-inputs
+     `(("go-github-com-alexcesaro-log" ,go-github-com-alexcesaro-log)
+       ("go-github-com-shazow-rateio" ,go-github-com-shazow-rateio)
+       ("go-golang-org-x-crypto" ,go-golang-org-x-crypto)
+       ("go-golang-org-x-text" ,go-golang-org-x-text)
+       ("go-github.com-howeyc-gopass" ,go-github.com-howeyc-gopass)
+       ("go-github.com-jessevdk-go-flags" ,go-github.com-jessevdk-go-flags)))
+    (arguments
+     `(#:install-source? #f
+       #:import-path "github.com/shazow/ssh-chat"
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'build
+           (lambda _
+             (with-directory-excursion "src/github.com/shazow/ssh-chat"
+               (invoke "make" "build")
+               #t)))
+         (replace 'install
+           (lambda* (#:key outputs import-path #:allow-other-keys)
+             (let ((dest    (string-append (assoc-ref outputs "out") "/bin"))
+                   (source  (string-append "src/" import-path "/")))
+               (install-file (string-append source "ssh-chat") dest)
+               #t))))))
+    (synopsis "Chat over SSH.")
+    (description "Custom SSH server written in Go. Instead of a shell, you get a chat prompt.")
+    (home-page "https://github.com/shazow/ssh-chat")
+    (license license:expat)))
-- 
2.25.1