sharlatan pushed a commit to branch go-team
in repository guix.

commit 32e1178466fe86246df937c095e8e559b2b360d0
Author: Sharlatan Hellseher <sharlata...@gmail.com>
AuthorDate: Fri Mar 28 22:47:21 2025 +0000

    gnu: nebula: Build service.
    
    * gnu/packages/networking.scm (nebula): Simplify package and build
    nebula-service.
    [arguments] <test-subdirs>: Remove it and test the whole source base.
    <build-flags>: Set version.
    <phases>: Use default 'install; adjust 'build to use default
    go-build-system functionality and build each command from "cmd".
    [inputs]: Add go-gvisor-dev-gvisor.
    
    Change-Id: I4a2f4717ad0a9e950910f9547625f41d0f8df58f
---
 gnu/packages/networking.scm | 37 +++++++++++++------------------------
 1 file changed, 13 insertions(+), 24 deletions(-)

diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index 955607a370..9c57027185 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -4850,32 +4850,22 @@ daemon.")
     (build-system go-build-system)
     (arguments
      (list
-      #:import-path "github.com/slackhq/nebula"
       #:install-source? #f
-      ;; XXX: Pack missing packages for cmd/nebula-service
-      #:test-subdirs #~(list ".")
+      #:import-path "github.com/slackhq/nebula"
+      #:build-flags
+      #~(list (format #f "-ldflags=-X main.Build=~a" #$version))
       #:phases
       #~(modify-phases %standard-phases
           (replace 'build
-            (lambda* (#:key import-path #:allow-other-keys)
-              ;; Suggested option to provide build time flags is not supported
-              ;; in Guix for go-build-system.
-              ;; -ldflags "-X main.Build=SOMEVERSION"
-              (substitute* (string-append "src/" import-path 
"/cmd/nebula/main.go")
-                (("Version: ")
-                 (string-append "Version: " #$version)))
-              ;; 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 _
-              (let* ((out #$output)
-                     (bindir (string-append out "/bin")))
-                (install-file "nebula" bindir)
-                (install-file "nebula-cert" bindir)))))))
+            (lambda* (#:key import-path #:allow-other-keys #:rest arguments)
+              (for-each
+               (lambda (cmd)
+                 (apply (assoc-ref %standard-phases 'build)
+                        `(,@arguments #:import-path
+                          ,(string-append import-path "/cmd/" cmd))))
+               (list "nebula"
+                     "nebula-service"
+                     "nebula-cert")))))))
     (inputs
      (list go-dario-cat-mergo
            go-github-com-anmitsu-go-shlex
@@ -4904,8 +4894,7 @@ daemon.")
            go-golang-zx2c4-com-wireguard
            go-google-golang-org-protobuf
            go-gopkg-in-yaml-v2
-           ;go-gvisor-dev-gvisor  ; for nebula-service, not packed yet
-           ))
+           go-gvisor-dev-gvisor))
     (home-page "https://github.com/slackhq/nebula";)
     (synopsis "Scalable, peer-to-peer overlay networking tool")
     (description

Reply via email to