From e14f407ab837d739e2949be0b75a4f28763e2657 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jurij=20Podgor=C5=A1ek?= Date: Mon, 3 Jul 2023 00:37:23 +0200 Subject: [PATCH] WIP forgejo guix paket --- kompot/packages/forgejo.scm | 80 +++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 kompot/packages/forgejo.scm diff --git a/kompot/packages/forgejo.scm b/kompot/packages/forgejo.scm new file mode 100644 index 0000000..6ea3d19 --- /dev/null +++ b/kompot/packages/forgejo.scm @@ -0,0 +1,80 @@ +(define-module (kompot packages forgejo) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix packages) + #:use-module (guix download) + #:use-module (guix gexp) + #:use-module (guix build-system go) + #:use-module (gnu packages bash) + #:use-module (gnu packages node) + #:use-module (gnu packages version-control)) + +(define-public forgejo + (package + (name "forgejo") + (version "1.19.3-0") + (source (origin + (method url-fetch) + (uri (string-append "https://codeberg.org/forgejo/forgejo" + "/archive/v" version ".tar.gz")) + (sha256 + (base32 "0492psgag2v8kaipzbhq8w6p8d72sfxpblj8j37fpz0pzf2kxriz")))) + (build-system go-build-system) + (arguments + `(#:install-source? #f + #:phases + (modify-phases %standard-phases + (add-after 'patch-source-shebangs 'unpatch-example-shebangs + ;; If we don't do this then git repos created with this version of + ;; gitea will use the build environment's bash for the different + ;; git repo hooks. + (lambda _ + (substitute* + (find-files "src/integrations/gitea-repositories-meta" + "(\\.sample|gitea|(post|pre)-receive|update)") + (("#!/gnu/store/.*/bin/bash") "#!/bin/bash") + (("#!/gnu/store/.*/bin/sh") "#!/bin/sh")))) + (add-before 'build 'prepare-build + (lambda _ + (setenv "TAGS" "bindata sqlite sqlite_unlock_notify") + (setenv "GITEA_WORK_DIR" "/var/lib/gitea"))) + (replace 'build + (lambda _ + (with-directory-excursion "src" + (invoke "make" "build") + (invoke "make" "generate-manpage")))) + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (unsetenv "GITEA_WORK_DIR") + (with-directory-excursion "src" + (invoke "make" "test-backend") + ;; Gitea requires git with lfs support to run tests. + ;(invoke "make" "test-sqlite") + (invoke "make" "test-sqlite-migration"))))) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out"))) + (with-directory-excursion "src" + (invoke "make" "install") + (install-file "man/man1/gitea.1.gz" + (string-append out "/share/man/man1")))))) + (add-after 'install 'wrap-program + (lambda* (#:key outputs inputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (bin (string-append out "/bin/gitea"))) + (wrap-program bin + `("PATH" ":" prefix + (,(dirname (search-input-file inputs "/bin/git"))))))))))) + (native-inputs + (list node-14.19.3)) + (inputs + (list bash-minimal + git)) + (home-page "https://gitea.io/") + (synopsis "Self-hosted git service") + (description "Gitea is an open-source forge software package for hosting +software development version control using Git as well as other collaborative +features like bug tracking, wikis and code review.") + (properties + '((release-monitoring-url . "https://github.com/go-gitea/gitea/releases"))) + (license license:expat)))