rosenthal: Add sing-box.

* modules/rosenthal/packages/networking.scm (sing-box): New variable.
* modules/rosenthal/packages/binaries.scm (sing-box-bin): Deprecated by it.
This commit is contained in:
Hilton Chain 2025-05-13 21:31:09 +08:00
parent b0231df023
commit aeff89a063
No known key found for this signature in database
GPG Key ID: ACC66D09CA528292
2 changed files with 87 additions and 20 deletions

View File

@ -281,26 +281,7 @@ in sidebar.")
(make-icecat-extension sidebery))
(define-public sing-box-bin
(package
(name "sing-box-bin")
(version "1.11.8")
(source (origin
(method url-fetch)
(uri (string-append
"https://github.com/SagerNet/sing-box/releases/download/v"
version "/sing-box-" version "-linux-amd64.tar.gz"))
(sha256
(base32
"0fdv8wvkydm20fgpy30hm3b6v3vz09pim178faximpyv4846m46z"))))
(build-system copy-build-system)
(arguments (list #:install-plan #~'(("sing-box" "bin/"))))
(supported-systems '("x86_64-linux"))
(home-page "https://sing-box.sagernet.org/")
(synopsis "Universal proxy platform")
(description
"This package provides @command{sing-box}, a universal proxy platform.")
(license license:gpl3+)
(properties '((upstream-name . "sing-box")))))
(deprecated-package "sing-box-bin" sing-box))
(define-public tailscale-bin
(deprecated-package "tailscale-bin" tailscale))

View File

@ -136,6 +136,92 @@ It supports various protocols, making it a versatile tool for users seeking to
bypass network restrictions." )
(license license:gpl3+)))
(define-public sing-box
(package
(name "sing-box")
(version "1.11.10")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/SagerNet/sing-box")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32
"07vsg2zch1z6wk5k0zqj81n95l3crgzkgvafxkyy7za7y72h1jhr"))))
(build-system go-build-system)
(arguments
(list
#:tests? (not (%current-target-system)) ;TODO: Run test suite.
#:go go-1.23
#:install-source? #f
#:import-path "./cmd/sing-box"
#:build-flags
#~(list "-tags" (string-join
'("with_quic"
"with_dhcp"
"with_wireguard"
"with_ech"
"with_utls"
"with_reality_server"
"with_acme"
"with_clash_api"
"with_gvisor"))
(string-append
"-ldflags="
" -X github.com/sagernet/sing-box/constant.Version="
#$(package-version this-package)))
#:modules
'((ice-9 match)
((guix build gnu-build-system) #:prefix gnu:)
(guix build go-build-system)
(guix build utils))
#:phases
#~(modify-phases %standard-phases
(replace 'unpack
(lambda args
(unsetenv "GO111MODULE")
(apply (assoc-ref gnu:%standard-phases 'unpack) args)
(copy-recursively
#+(this-package-native-input "vendored-go-dependencies")
"vendor")))
(replace 'install-license-files
(assoc-ref gnu:%standard-phases 'install-license-files))
(add-after 'install 'install-extras
(lambda _
(let ((sing-box
(or (which "sing-box")
(in-vicinity #$output "bin/sing-box"))))
(map
(match-lambda
((shell . path)
(let ((file (in-vicinity #$output path)))
(mkdir-p (dirname file))
(with-output-to-file file
(lambda ()
(invoke sing-box "completion" shell))))))
'(("bash" . "etc/bash_completion.d/sing-box")
("fish" . "share/fish/vendor_completions.d/sing-box.fish")
("zsh" . "share/zsh/site-functions/_sing-box")))))))))
(native-inputs
(append
(list (origin
(method (go-mod-vendor #:go go-1.23))
(uri (package-source this-package))
(file-name "vendored-go-dependencies")
(sha256
(base32
"11607z2j6q6y20z7lkvhcd8z498mry6291lx69j73qa88wbc0mzd"))))
(if (%current-target-system)
(list this-package)
'())))
(home-page "https://sing-box.sagernet.org/")
(synopsis "Universal proxy platform")
(description
"@command{sing-box} is a customizable and univsersal proxy platform that
can be used to create network proxy servers, clients and transparent proxies.")
(license license:gpl3+)))
(define-public socks2http
(package
(name "socks2http")