Subject: [bug#54335] [PATCH 14/14] gnu: Add nebula.

From: Dominic Martinez <[email-masked]>
Date: Thu, 10 Mar 2022 22:47:41 -0500

* gnu/packages/networking.scm (nebula): New variable.
---
 gnu/packages/networking.scm | 80 +++++++++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)

diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index b45f2f79f2..ab5be17241 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -48,6 +48,7 @@
 ;;; Copyright © 2021 Guillaume Le Vaillant <[email-masked]>
 ;;; Copyright © 2021 Maxime Devos <[email-masked]>
 ;;; Copyright © 2022 Simon South <[email-masked]>
+;;; Copyright © 2022 Dominic Martinez <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -140,6 +141,7 @@ (define-module (gnu packages networking)
   #:use-module (gnu packages shells)
   #:use-module (gnu packages sphinx)
   #:use-module (gnu packages sqlite)
+  #:use-module (gnu packages syncthing)
   #:use-module (gnu packages ssh)
   #:use-module (gnu packages tcl)
   #:use-module (gnu packages textutils)
@@ -4191,3 +4193,81 @@ (define-public putty
 implementations.")
     (home-page "https://www.chiark.greenend.org.uk/~sgtatham/putty/")
     (license license:expat)))
+
+(define-public nebula
+  ;; NOTE: does not include nebula-service, which is incompatible with
+  ;; Shepherd.
+  (package
+    (name "nebula")
+    (version "1.5.2")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/slackhq/nebula")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "14b7wgx83w1fhcbhsn0mfg872hkml4wwbzimb3bjvc3xpzx6w44k"))))
+    (build-system go-build-system)
+    (arguments
+     `(#:import-path "github.com/slackhq/nebula"
+       #:install-source? #f
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'build
+           (lambda _
+             ;; Build nebula and nebula cert
+             (let* ((dir "github.com/slackhq/nebula")
+                    (nebula-cmd (string-append dir "/cmd/nebula"))
+                    (cert-cmd (string-append dir "/cmd/nebula-cert")))
+               (invoke "go" "build" nebula-cmd)
+               (invoke "go" "build" cert-cmd))))
+
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (bindir (string-append out "/bin")))
+               (install-file "nebula" bindir)
+               (install-file "nebula-cert" bindir)))))))
+    (native-inputs
+     (list go-gopkg-in-yaml-v3
+           go-golang-org-x-term
+           go-github-com-prometheus-common
+           go-github-com-pmezard-go-difflib
+           go-github-com-matttproud-golang-protobuf-extensions
+           go-github-com-davecgh-go-spew
+           go-gopkg-in-yaml-v2
+           go-google-golang-org-protobuf
+           go-golang-org-x-sys
+           go-golang-org-x-net
+           go-golang-org-x-crypto
+           go-github-com-vishvananda-netns
+           go-github-com-vishvananda-netlink
+           go-github-com-skip2-go-qrcode
+           go-github-com-stretchr-testify
+           go-github-com-songgao-water
+           go-github-com-sirupsen-logrus
+           go-github-com-rcrowley-go-metrics
+           go-github-com-prometheus-procfs
+           go-github-com-prometheus-client-model
+           go-github-com-prometheus-client-golang
+           go-github-com-nbrownus-go-metrics-prometheus
+           go-github-com-miekg-dns
+           go-github-com-imdario-mergo
+           go-github-com-google-gopacket
+           go-github-com-gogo-protobuf
+           go-github-com-flynn-noise
+           go-github-com-cyberdelia-go-metrics-graphite
+           go-github-com-cespare-xxhash-v2
+           go-github-com-armon-go-radix
+           go-github-com-anmitsu-go-shlex))
+    (home-page "https://github.com/slackhq/nebula")
+    (synopsis "Scalable overlay networking tool")
+    (description
+     "Nebula is a scalable overlay networking tool with a focus on performance,
+simplicity and security.  It lets you seamlessly connect computers anywhere in
+the world.  Nebula is portable, and runs on Linux, OSX, Windows, iOS, and
+Android.  It can be used to connect a small number of computers, but is also
+able to connect tens of thousands of computers.")
+    (license license:expat)))
-- 
2.34.0