From a497817bfedcbdcee29152daa56c7f942453e239 Mon Sep 17 00:00:00 2001 From: Sharlatan Hellseher Date: Tue, 12 Aug 2025 17:19:07 +0100 Subject: [PATCH] gnu: Add git-sync. * gnu/packages/golang-vcs.scm (git-sync): New variable. Change-Id: I3592c88e4de7e8da652f2dc7b9b908659b16276b --- gnu/packages/golang-vcs.scm | 47 +++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/gnu/packages/golang-vcs.scm b/gnu/packages/golang-vcs.scm index 74dceed8eca..9dea0285b04 100644 --- a/gnu/packages/golang-vcs.scm +++ b/gnu/packages/golang-vcs.scm @@ -34,6 +34,7 @@ #:use-module (gnu packages golang-web) #:use-module (gnu packages golang-xyz) #:use-module (gnu packages haskell-apps) + #:use-module (gnu packages prometheus) #:use-module (gnu packages python-check) #:use-module (gnu packages version-control)) @@ -455,6 +456,52 @@ interact with GitLab in a simple and uniform way.") ;;; Executables: ;;; +(define-public git-sync + (package + (name "git-sync") + (version "4.4.2") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/kubernetes/git-sync") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "0wp142i5yv9bwrq743wgd6kvmnl270wwmc8ysll3mglqwh3jyjlb")) + (modules '((guix build utils))) + (snippet + '(begin + (delete-file-recursively "vendor"))))) + (build-system go-build-system) + (arguments + (list + #:install-source? #f + #:import-path "k8s.io/git-sync" + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'fix-main-path + ;; Build fails if that commit is kept. + (lambda* (#:key tests? import-path #:allow-other-keys) + (with-directory-excursion (string-append "src/" import-path) + (substitute* "main.go" + (("// import .k8s.io/git-sync/cmd/git-sync.") "")))))))) + (native-inputs + (list go-github-com-go-logr-logr + go-github-com-golang-jwt-jwt-v4 + go-github-com-prometheus-client-golang + go-github-com-spf13-pflag + go-go-uber-org-goleak + go-golang-org-x-sys)) + (home-page "https://github.com/kubernetes/git-sync") + (synopsis "Keep repository in sync with the upstream") + (description + "git-sync is a simple command that pulls a git repository into a local +directory. It is a perfect \"sidecar\" container in Kubernetes - it can +periodically pull files down from a repository so that an application can +consume them.") + (license license:asl2.0))) + ;;; ;;; Avoid adding new packages to the end of this file. To reduce the chances ;;; of a merge conflict, place them above in alphabetic order.