Rosenthal/rosenthal/packages/networking.scm
Hilton Chain 2531f04148
rosenthal: cloudflared: Update to 2025.4.0.
* rosenthal/packages/networking.scm (cloudflared): Update to 2025.4.0.
2025-04-19 01:32:13 +08:00

163 lines
6.4 KiB
Scheme

;; SPDX-FileCopyrightText: 2022-2024 Hilton Chain <hako@ultrarare.space>
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
(define-module (rosenthal packages networking)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix build-system go)
#:use-module (guix gexp)
#:use-module (guix git-download)
#:use-module (guix packages)
#:use-module (rosenthal utils download)
#:use-module (gnu packages golang)
#:use-module (gnu packages golang-build))
(define-public cloudflared
(package
(name "cloudflared")
(version "2025.4.0")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/cloudflare/cloudflared")
(commit version)))
(file-name (git-file-name name version))
;; TODO: Unbundle vendored dependencies.
;; (modules '((guix build utils)))
;; (snippet '(delete-file-recursively "vendor"))
(sha256
(base32
"03bhkd5cgrw2srgh82xv1y95zkpx4v2rqdy9azhv4y7fzz07p89w"))))
(build-system go-build-system)
(arguments
(list #:go go-1.23
#:install-source? #f
#:import-path "github.com/cloudflare/cloudflared/cmd/cloudflared"
#:unpack-path "github.com/cloudflare/cloudflared"
#:build-flags
#~(list (string-append
"-ldflags="
" -X main.Version=" #$(package-version this-package)
" -X github.com/cloudflare/cloudflared/cmd/cloudflared/updater.BuiltForPackageManager=Guix"))
#:phases
#~(modify-phases %standard-phases
(add-before 'build 'disable-cgo
(lambda _
(setenv "CGO_ENABLED" "0")))
(add-after 'install 'install-documentation
(lambda _
(let ((src "src/github.com/cloudflare/cloudflared/cloudflared_man_template")
(dst (string-append #$output "/share/man/man1/cloudflared.1")))
(substitute* src
(("\\$\\{VERSION\\}") #$(package-version this-package)))
(mkdir-p (dirname dst))
(copy-file src dst)))))))
(home-page "https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/")
(synopsis "Cloudflare Tunnel client")
(description
"This package provides the command-line client for Cloudflare Tunnel, a
tunneling daemon that proxies traffic from the Cloudflare network to your
origins. This daemon sits between Cloudflare network and your origin (e.g. a
webserver). Cloudflare attracts client requests and sends them to you via
this daemon, without requiring you to poke holes on your firewall --- your
origin can remain as closed as possible.")
(license license:asl2.0)))
(define-public socks2http
(package
(name "socks2http")
(version "0.0.0-20160712034938-bafa2cde8eb4")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/zenhack/socks2http")
(commit (go-version->git-ref version))))
(file-name (git-file-name name version))
(sha256
(base32
"0c388rir9d0cy5vxqxj7m72nra0w5cya4mmgqdcvqmnk2vawdyb9"))))
(build-system go-build-system)
(arguments
(list #:install-source? #f
#:import-path "github.com/zenhack/socks2http"))
(inputs (list go-golang-org-x-net))
(home-page "https://github.com/zenhack/socks2http")
(synopsis "SOCKS5 to HTTP proxy")
(description
"This package provides a simple tool to plumb HTTP proxy requests through
a SOCKS5 proxy.")
(license license:expat)))
(define-public tailscale
(package
(name "tailscale")
(version "1.80.3")
(source
(origin
(method go-vendored-fetch)
(uri (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/tailscale/tailscale")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32
"07s8kwksvd0f9r65zkrhp3sn4jrv0c8g5w0wbiv9qq950l8gdv2h"))))
(file-name (git-file-name name version))
(sha256
(base32
"0g2pzazrfl41s1gra2g3ni34ddgw32mb2rjlv8x17g3yc7axdbqa"))
(modules '((guix build utils)))
(snippet '(delete-file-recursively "tool"))))
(build-system go-build-system)
(arguments
(list
#:go go-1.23
#:install-source? #f
#:import-path "."
#:build-flags
#~(list "-tags" "ts_include_cli"
(string-append
"-ldflags="
" -X tailscale.com/version.longStamp=v"
#$(package-version this-package)
" -X tailscale.com/version.shortStamp=v"
#$(package-version this-package)))
#:test-flags ''("-skip=^TestPackageDocs$")
#:test-subdirs ''(".")
#:modules
'(((guix build gnu-build-system) #:prefix gnu:)
(guix build go-build-system)
(guix build utils))
#:phases
#~(modify-phases %standard-phases
(replace 'unpack
(lambda args
(apply (assoc-ref gnu:%standard-phases 'unpack) args)
(unsetenv "GO111MODULE")))
(replace 'install-license-files
(assoc-ref gnu:%standard-phases 'install-license-files))
;; TODO: Fix command references.
(replace 'build
(lambda* (#:key build-flags parallel-build? #:allow-other-keys)
(let* ((njobs (if parallel-build? (parallel-job-count) 1)))
(setenv "GOMAXPROCS" (number->string njobs))
(for-each
(lambda (pkg)
(apply invoke "go" "build" "-ldflags=-s -w" "-trimpath"
"-o" (string-append #$output "/bin/" pkg)
`(,@build-flags
,(string-append "tailscale.com/cmd/" pkg))))
'("derper"
"derpprobe"
"tailscale"
"tailscaled"
"tsidp"))))))))
(home-page "https://tailscale.com/")
(synopsis "Private WireGuard® networks made easy")
(description
"This package provides @command{tailscale}, which brings an easy and secure
way to use WireGuard and 2FA.")
(license license:bsd-3)))