(use-modules (gnu packages golang)
(gnu packages golang-build)
(gnu packages golang-check)
(gnu packages golang-compression)
(gnu packages golang-crypto)
(gnu packages golang-web)
(gnu packages golang-xyz)
(gnu packages prometheus)
(guix build-system go)
(guix git-download)
(guix gexp)
((guix licenses) #:prefix license:)
(guix packages)
(guix utils))
(define-public go-github-com-aleksi-pointer
(package
(name "go-github-com-aleksi-pointer")
(version "1.2.0")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/AlekSi/pointer")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32 "0rncmanv62wwy7ihvjhvb695mkvy4kdzhgnn90zygs9yrfzzk0wk"))))
(build-system go-build-system)
(arguments
(list
#:import-path "github.com/AlekSi/pointer"))
(home-page "https://github.com/AlekSi/pointer")
(synopsis "pointer")
(description
"Package pointer provides helpers to convert between pointers and values of
built-in (and, with generics, of any) types.")
(license license:expat)))
(define-public go-go-mongodb-org-mongo-driver
(package
(name "go-go-mongodb-org-mongo-driver")
(version "1.17.6")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/mongodb/mongo-go-driver")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32 "0n1vxs3dcjcrj3lmhw8jvqnwqnbj82jxqcb1l74ga1r8vp2qqrcb"))))
(build-system go-build-system)
(arguments
(list
#:import-path "go.mongodb.org/mongo-driver"
#:skip-build? #t
#:tests? #f)) ;; Some tests require network access.
(propagated-inputs (list go-golang-org-x-sync
go-golang-org-x-crypto
go-github-com-youmark-pkcs8
go-github-com-xdg-go-stringprep
go-github-com-xdg-go-scram
go-github-com-klauspost-compress
go-github-com-google-go-cmp
go-github-com-golang-snappy
go-github-com-davecgh-go-spew))
(home-page "https://go.mongodb.org/mongo-driver")
(synopsis "MongoDB Go Driver")
(description "The @code{MongoDB} supported driver for Go.")
(license license:asl2.0)))
(define-public go-go-mongodb-org-mongo-driver-2
(let ((base go-go-mongodb-org-mongo-driver))
(package
(inherit base)
(name "go-go-mongodb-org-mongo-driver-2")
(version "2.4.1")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/mongodb/mongo-go-driver")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32 "0x1v8p6wkviqabiqzdrydd1n520h77b29yvm779r82gmj593zxa9"))))
(arguments
(substitute-keyword-arguments (package-arguments base)
((#:import-path import-path) "go.mongodb.org/mongo-driver/v2")))
(propagated-inputs `(("go-github-com-golang-snappy"
,go-github-com-golang-snappy)
. ,(package-propagated-inputs base)))
(synopsis "MongoDB Go Driver, version 2"))))
(define-public go-github-com-ferretdb-wire
(package
(name "go-github-com-ferretdb-wire")
(version "0.0.8")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/FerretDB/wire")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32 "19klzbdjhhkdxslnx8ls3i7n421z4ihra4zigrv52bdv90l4xmdf"))))
(build-system go-build-system)
(arguments
(list
#:import-path "github.com/FerretDB/wire"
#:tests? #f)) ;; Some tests require network access.
(propagated-inputs (list go-github-com-xdg-go-scram
go-github-com-stretchr-testify))
(home-page "https://github.com/FerretDB/wire")
(synopsis "wire")
(description
"Package wire provides
@@url{https://www.mongodb.com/docs/manual/reference/mongodb-wire-protocol/,@code{MongoDB}
wire protocol} implementation.")
(license license:asl2.0)))
(define-public go-ferretdb
(package
(name "go-github-com-ferretdb-ferretdb")
(version "1.24.2")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/FerretDB/FerretDB")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32 "1436ba27asaw2c35nklgar6b2zas1clgsm8fz8a6c8wcy901qnxg"))))
(build-system go-build-system)
(arguments
(list
#:unpack-path "github.com/FerretDB/FerretDB"
#:import-path "github.com/FerretDB/FerretDB/cmd/ferretdb"
#:install-source? #f
#:tests? #f ;; Tests expect .git.
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'do-not-use-fallback-x509roots
(lambda* (#:key unpack-path #:allow-other-keys)
(substitute* (map (lambda (subpath)
(format #f "src/~a/~a" unpack-path subpath))
'("go.mod" "cmd/ferretdb/main.go"))
((".*x509roots/fallback.*" line)
(format #f "//~a" line)))))
(add-after 'unpack 'do-not-use-statsviz
(lambda* (#:key unpack-path #:allow-other-keys)
(substitute* (map (lambda (subpath)
(format #f "src/~a/~a" unpack-path subpath))
'("go.mod"
"integration/go.mod"
"internal/util/debug/debug.go"))
((".*arl/statsviz.*" line)
(format #f "//~a" line)))
(substitute* (format #f "src/~a/~a" unpack-path
"internal/util/debug/debug.go")
((".*svOpts := .*" line)
(format #f "/*~a" line))
((".*statsviz.Register.*" line)
(format #f "~a*/" line))))))))
(native-inputs (list go-modernc-org-sqlite
go-golang-org-x-sys
go-golang-org-x-exp
go-go-uber-org-automaxprocs
go-go-opentelemetry-io-otel-trace
go-go-opentelemetry-io-otel-sdk
go-go-opentelemetry-io-otel-exporters-otlp-otlptrace
go-go-opentelemetry-io-otel-exporters-otlp-otlptrace-otlptracehttp
go-go-opentelemetry-io-otel
go-go-mongodb-org-mongo-driver
go-github-com-prometheus-common
go-github-com-prometheus-client-model
go-github-com-prometheus-client-golang
go-github-com-jackc-pgx-v5
go-github-com-jackc-pgerrcode
go-github-com-google-uuid
go-github-com-go-sql-driver-mysql
go-github-com-alecthomas-kong
go-github-com-sap-go-hdb
go-github-com-ferretdb-wire
go-github-com-aleksi-pointer))
(home-page "https://github.com/FerretDB/FerretDB")
(synopsis "FerretDB")
(description
"@code{FerretDB} was founded to become the de-facto open-source substitute to
@code{MongoDB}. @code{FerretDB} is an open-source proxy, converting the
@code{MongoDB} 5.0+ wire protocol queries to SQL - using @code{PostgreSQL} or
SQLite as a database engine.")
(license license:asl2.0)))
go-ferretdb