[PATCH 0/3] gnu: Add restic-rest-server.

  • Done
  • quality assurance status badge
Details
3 participants
  • Timo Wilken
  • Leo Famulari
  • Timo Wilken
Owner
unassigned
Submitted by
Timo Wilken
Severity
normal
T
T
Timo Wilken wrote on 21 Apr 2023 21:53
(address . guix-patches@gnu.org)(name . Timo Wilken)(address . guix@twilken.net)
20230421195311.9345-1-guix@twilken.net
The restic REST server is a Go program that serves a restic backup repository
over HTTP.

Almost all dependencies were already packaged in Guix, though some in (gnu
packages syncthing). I moved these to (gnu packages golang) with the rest of
the Go dependencies, as that seemed appropriate.

Timo Wilken (3):
gnu: Move golang dependencies to (gnu packages golang).
gnu: Add go-github-com-coreos-go-systemd-activation.
gnu: Add restic-rest-server.

gnu/packages/backup.scm | 48 ++++++++++++++++
gnu/packages/golang.scm | 115 ++++++++++++++++++++++++++++++++++++-
gnu/packages/syncthing.scm | 90 -----------------------------
3 files changed, 162 insertions(+), 91 deletions(-)


base-commit: 13ebf5e36cc676627a19072d3712c399b7aae61f
--
2.39.2
T
T
Timo Wilken wrote on 21 Apr 2023 21:55
[PATCH 1/3] gnu: Move golang dependencies to (gnu packages golang).
(address . 63003@debbugs.gnu.org)(name . Timo Wilken)(address . guix@twilken.net)
20230421195515.10316-1-guix@twilken.net
These packages are needed by syncthing and the new restic-rest-server package,
so put them in (gnu packages golang) instead.

* gnu/packages/syncthing.scm (go-github-com-prometheus-common,
go-github-com-prometheus-procfs, go-github-com-prometheus-client-golang):
Delete variables.
* gnu/packages/golang.scm (go-github-com-prometheus-common,
go-github-com-prometheus-procfs, go-github-com-prometheus-client-golang):
Move deleted variables here.
---
gnu/packages/golang.scm | 90 ++++++++++++++++++++++++++++++++++++++
gnu/packages/syncthing.scm | 90 --------------------------------------
2 files changed, 90 insertions(+), 90 deletions(-)

Toggle diff (204 lines)
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 24dae34e20..cca5aacdb6 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -9497,6 +9497,96 @@ (define-public go-github-com-godbus-dbus
bindings for the D-Bus message bus system.")
(license license:bsd-2)))
+(define-public go-github-com-prometheus-common
+ (package
+ (name "go-github-com-prometheus-common")
+ (version "0.4.1")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/prometheus/common")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0sf4sjdckblz1hqdfvripk3zyp8xq89w7q75kbsyg4c078af896s"))))
+ (build-system go-build-system)
+ (arguments
+ '(#:import-path "github.com/prometheus/common"
+ #:tests? #f
+ #:phases
+ (modify-phases %standard-phases
+ ;; Source-only package
+ (delete 'build))))
+ (propagated-inputs
+ (list go-github-com-golang-protobuf-proto
+ go-github-com-matttproud-golang-protobuf-extensions-pbutil
+ go-github-com-prometheus-client-model))
+ (synopsis "Prometheus metrics")
+ (description "This package provides tools for reading and writing
+Prometheus metrics.")
+ (home-page "https://github.com/prometheus/common")
+ (license license:asl2.0)))
+
+(define-public go-github-com-prometheus-procfs
+ (package
+ (name "go-github-com-prometheus-procfs")
+ (version "0.0.4")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/prometheus/procfs")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1z5jq5rjala0a0di4nwk1rai0z9f73qwqj6mgcbpjbg2qknlb544"))))
+ (build-system go-build-system)
+ (arguments
+ '(#:import-path "github.com/prometheus/procfs"
+ ;; The tests require Go modules, which are not yet supported in Guix's
+ ;; Go build system.
+ #:tests? #f))
+ (synopsis "Go library for reading @file{/proc}")
+ (description "The @code{procfs} Go package provides functions to retrieve
+system, kernel, and process metrics from the @file{/proc} pseudo file system.")
+ (home-page "https://github.com/prometheus/procfs")
+ (license license:asl2.0)))
+
+(define-public go-github-com-prometheus-client-golang
+ (package
+ (name "go-github-com-prometheus-client-golang")
+ (version "1.2.1")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/prometheus/client_golang")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0zs49psk23n9z8wrl02d5vib5wclpym8kaxcy6n5pk696i419065"))))
+ (build-system go-build-system)
+ (arguments
+ '(#:tests? #f
+ #:import-path "github.com/prometheus/client_golang"
+ #:phases
+ (modify-phases %standard-phases
+ ;; Source-only package
+ (delete 'build))))
+ (propagated-inputs
+ (list go-github-com-beorn7-perks-quantile
+ go-github-com-golang-protobuf-proto
+ go-github-com-prometheus-client-model
+ go-github-com-prometheus-common
+ go-github-com-prometheus-procfs
+ go-github-com-cespare-xxhash))
+ (synopsis "HTTP server and client tools for Prometheus")
+ (description "This package @code{promhttp} provides HTTP client and
+server tools for Prometheus metrics.")
+ (home-page "https://github.com/prometheus/client_golang")
+ (license license:asl2.0)))
+
(define-public go-github-com-zalando-go-keyring
(package
(name "go-github-com-zalando-go-keyring")
diff --git a/gnu/packages/syncthing.scm b/gnu/packages/syncthing.scm
index c4204f32fe..dd54100ce6 100644
--- a/gnu/packages/syncthing.scm
+++ b/gnu/packages/syncthing.scm
@@ -877,96 +877,6 @@ (define-public go-github-com-matttproud-golang-protobuf-extensions-pbutil
(home-page "https://github.com/matttproud/golang_protobuf_extensions")
(license asl2.0))))
-(define-public go-github-com-prometheus-common
- (package
- (name "go-github-com-prometheus-common")
- (version "0.4.1")
- (source (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/prometheus/common")
- (commit (string-append "v" version))))
- (file-name (git-file-name name version))
- (sha256
- (base32
- "0sf4sjdckblz1hqdfvripk3zyp8xq89w7q75kbsyg4c078af896s"))))
- (build-system go-build-system)
- (arguments
- '(#:import-path "github.com/prometheus/common"
- #:tests? #f
- #:phases
- (modify-phases %standard-phases
- ;; Source-only package
- (delete 'build))))
- (propagated-inputs
- (list go-github-com-golang-protobuf-proto
- go-github-com-matttproud-golang-protobuf-extensions-pbutil
- go-github-com-prometheus-client-model))
- (synopsis "Prometheus metrics")
- (description "This package provides tools for reading and writing
-Prometheus metrics.")
- (home-page "https://github.com/prometheus/common")
- (license asl2.0)))
-
-(define-public go-github-com-prometheus-procfs
- (package
- (name "go-github-com-prometheus-procfs")
- (version "0.0.4")
- (source (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/prometheus/procfs")
- (commit (string-append "v" version))))
- (file-name (git-file-name name version))
- (sha256
- (base32
- "1z5jq5rjala0a0di4nwk1rai0z9f73qwqj6mgcbpjbg2qknlb544"))))
- (build-system go-build-system)
- (arguments
- '(#:import-path "github.com/prometheus/procfs"
- ;; The tests require Go modules, which are not yet supported in Guix's
- ;; Go build system.
- #:tests? #f))
- (synopsis "Go library for reading @file{/proc}")
- (description "The @code{procfs} Go package provides functions to retrieve
-system, kernel, and process metrics from the @file{/proc} pseudo file system.")
- (home-page "https://github.com/prometheus/procfs")
- (license asl2.0)))
-
-(define-public go-github-com-prometheus-client-golang
- (package
- (name "go-github-com-prometheus-client-golang")
- (version "1.2.1")
- (source (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/prometheus/client_golang")
- (commit (string-append "v" version))))
- (file-name (git-file-name name version))
- (sha256
- (base32
- "0zs49psk23n9z8wrl02d5vib5wclpym8kaxcy6n5pk696i419065"))))
- (build-system go-build-system)
- (arguments
- '(#:tests? #f
- #:import-path "github.com/prometheus/client_golang"
- #:phases
- (modify-phases %standard-phases
- ;; Source-only package
- (delete 'build))))
- (propagated-inputs
- (list go-github-com-beorn7-perks-quantile
- go-github-com-golang-protobuf-proto
- go-github-com-prometheus-client-model
- go-github-com-prometheus-common
- go-github-com-prometheus-procfs
- go-github-com-cespare-xxhash))
- (synopsis "HTTP server and client tools for Prometheus")
- (description "This package @code{promhttp} provides HTTP client and
-server tools for Prometheus metrics.")
- (home-page "https://github.com/prometheus/client_golang")
- (license asl2.0)))
-
(define-public go-github-com-go-asn1-ber-asn1-ber
(package
(name "go-github-com-go-asn1-ber-asn1-ber")
--
2.39.2
T
T
Timo Wilken wrote on 21 Apr 2023 21:55
[PATCH 3/3] gnu: Add restic-rest-server.
(address . 63003@debbugs.gnu.org)(name . Timo Wilken)(address . guix@twilken.net)
20230421195515.10316-3-guix@twilken.net
* gnu/packages/backup.scm (restic-rest-server): New variable.
---
gnu/packages/backup.scm | 48 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)

Toggle diff (68 lines)
diff --git a/gnu/packages/backup.scm b/gnu/packages/backup.scm
index 134647d33d..94e8e3acc4 100644
--- a/gnu/packages/backup.scm
+++ b/gnu/packages/backup.scm
@@ -23,6 +23,7 @@
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2022 Feng Shu <tumashu@163.com>
+;;; Copyright © 2023 Timo Wilken <guix@twilken.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -1029,6 +1030,53 @@ (define-public restic
@end itemize")
(license license:bsd-2)))
+(define-public restic-rest-server
+ (package
+ (name "restic-rest-server")
+ (version "0.11.0")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/restic/rest-server")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1nvmxc9x0mlks6yfn66fmwn50k5q83ip4g9vvb0kndzd7hwcyacy"))))
+ (build-system go-build-system)
+ (arguments
+ '(#:import-path "github.com/restic/rest-server/cmd/rest-server"
+ #:unpack-path "github.com/restic/rest-server"
+ #:install-source? #f ;all we need is the binary
+ #:phases (modify-phases %standard-phases
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys . args)
+ (when tests?
+ ;; Unit tests seems to break with Guix' non-standard TMPDIR.
+ (setenv "TMPDIR" "/tmp")
+ (apply (assoc-ref %standard-phases
+ 'check) args))))
+ (add-after 'install 'rename-binary
+ (lambda* (#:key outputs #:allow-other-keys)
+ (with-directory-excursion (assoc-ref outputs "out")
+ ;; "rest-server" is a bit too generic.
+ (rename-file "bin/rest-server"
+ "bin/restic-rest-server")))))))
+ (propagated-inputs (list go-golang-org-x-crypto
+ go-github-com-spf13-cobra
+ go-github-com-prometheus-client-golang
+ go-github-com-miolini-datacounter
+ go-github-com-minio-sha256-simd
+ go-github-com-gorilla-handlers
+ go-github-com-coreos-go-systemd-activation))
+ (home-page "https://github.com/restic/rest-server")
+ (synopsis "Restic REST server")
+ (description
+ "The Restic REST server is a high performance HTTP server that implements
+restic's REST backend API. It provides a secure and efficient way to backup
+data remotely, using the restic backup client and a @code{rest:} URL.")
+ (license license:bsd-2)))
+
(define-public zbackup
(package
(name "zbackup")
--
2.39.2
T
T
Timo Wilken wrote on 21 Apr 2023 21:55
[PATCH 2/3] gnu: Add go-github-com-coreos-go-systemd-activation.
(address . 63003@debbugs.gnu.org)(name . Timo Wilken)(address . guix@twilken.net)
20230421195515.10316-2-guix@twilken.net
Required by restic-rest-server; see following commit.

* gnu/packages/golang.scm (go-github-com-coreos-go-systemd-activation): New variable.
---
gnu/packages/golang.scm | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)

Toggle diff (45 lines)
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index cca5aacdb6..78864291ae 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -8964,6 +8964,29 @@ (define-public go-github-com-coreos-go-semver
It lets you parse and compare two semantic version strings.")
(license license:asl2.0)))
+(define-public go-github-com-coreos-go-systemd-activation
+ (package
+ (name "go-github-com-coreos-go-systemd-activation")
+ (version "0.0.0-20191104093116-d3cd4ed1dbcf")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/coreos/go-systemd")
+ (commit (go-version->git-ref version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "193mgqn7n4gbb8jb5kyn6ml4lbvh4xs55qpjnisaz7j945ik3kd8"))))
+ (build-system go-build-system)
+ (arguments
+ '(#:import-path "github.com/coreos/go-systemd/activation"
+ #:unpack-path "github.com/coreos/go-systemd"))
+ (home-page "https://github.com/coreos/go-systemd")
+ (synopsis "Go bindings to systemd socket activation")
+ (description "Go bindings to systemd socket activation; for writing and
+using socket activation from Go.")
+ (license license:asl2.0)))
+
(define-public go-github-com-emirpasic-gods
(package
(name "go-github-com-emirpasic-gods")
@@ -8980,7 +9003,7 @@ (define-public go-github-com-emirpasic-gods
(build-system go-build-system)
(arguments
`(#:import-path "github.com/emirpasic/gods"
- ; Source-only package
+ ; Source-only package
#:tests? #f
#:phases
(modify-phases %standard-phases
--
2.39.2
T
T
Timo Wilken wrote on 21 Apr 2023 21:59
(address . 63003@debbugs.gnu.org)(address . guix@twilken.net)
CS2P83FQAUI6.38GIRA1N7OB91@lap.twilken.net
On Fri Apr 21, 2023 at 9:55 PM CEST, Timo Wilken wrote:
Toggle quote (14 lines)
> Required by restic-rest-server; see following commit.
>
> * gnu/packages/golang.scm (go-github-com-coreos-go-systemd-activation): New variable.
>
> @@ -8980,7 +9003,7 @@ (define-public go-github-com-emirpasic-gods
> (build-system go-build-system)
> (arguments
> `(#:import-path "github.com/emirpasic/gods"
> - ; Source-only package
> + ; Source-only package
> #:tests? #f
> #:phases
> (modify-phases %standard-phases

Oops, sorry about this accidental reformatting! Should I resend this
patch series or can that be removed when applying the commit?
L
L
Leo Famulari wrote on 23 Apr 2023 16:47
Re: [bug#63003] [PATCH 3/3] gnu: Add restic-rest-server.
(name . Timo Wilken)(address . guix@twilken.net)(address . 63003-done@debbugs.gnu.org)
ZEVFC6FVDg857TcJ@jasmine.lan
On Fri, Apr 21, 2023 at 09:55:15PM +0200, Timo Wilken wrote:
Toggle quote (2 lines)
> * gnu/packages/backup.scm (restic-rest-server): New variable.

Thanks Timo! I pushed the patches as
bcf63e6bf2ed3dec447d5c2fa3bc67b784eacbe1
Closed
T
T
Timo Wilken wrote on 23 Apr 2023 16:50
(address . 63003-done@debbugs.gnu.org)
166F8B9A-32D1-402B-A8AA-E7CB01A5EA3C@twilken.net
On 23 April 2023 16:47:39 CEST, Leo Famulari <leo@famulari.name> wrote:
Toggle quote (3 lines)
>Thanks Timo! I pushed the patches as
>bcf63e6bf2ed3dec447d5c2fa3bc67b784eacbe1

Perfect, thank you Leo!
Closed
?