rosenthal: forgejo: Refresh package.

* modules/rosenthal/packages/web.scm (forgejo): Sync package with
https://gitlab.com/nonguix/nonguix/-/merge_requests/669.
This commit is contained in:
Hilton Chain 2025-05-15 15:18:15 +08:00
parent 2b37b85997
commit de236c188b
No known key found for this signature in database
GPG Key ID: ACC66D09CA528292

View File

@ -12,7 +12,8 @@
#:use-module (guix build-system go) #:use-module (guix build-system go)
#:use-module (gnu packages golang) #:use-module (gnu packages golang)
#:use-module (gnu packages image) #:use-module (gnu packages image)
#:use-module (gnu packages web)) #:use-module (gnu packages web)
#:use-module (gnu packages version-control))
(define-public buku-run-dev (define-public buku-run-dev
(let ((revision "23") (let ((revision "23")
@ -113,11 +114,11 @@ designed for flexibility. With its advanced templating system and fast asset
pipelines, Hugo renders a complete site in seconds, often less.") pipelines, Hugo renders a complete site in seconds, often less.")
(license license:asl2.0))) (license license:asl2.0)))
;; TODO: Package Forgejo without vendored dependencies.
(define-public forgejo (define-public forgejo
(package (package
(name "forgejo") (name "forgejo")
(version "10.0.3") (version "10.0.3")
;; TODO: Address npm dependencies and fetch from git.
(source (origin (source (origin
(method url-fetch) (method url-fetch)
(uri (string-append (uri (string-append
@ -125,13 +126,17 @@ pipelines, Hugo renders a complete site in seconds, often less.")
version "/forgejo-src-" version ".tar.gz")) version "/forgejo-src-" version ".tar.gz"))
(sha256 (sha256
(base32 (base32
"0cqp4x3xrvr7q1pkijqmf6jnx3wahi20xjfrv7ap81ykif83269x")))) "0cqp4x3xrvr7q1pkijqmf6jnx3wahi20xjfrv7ap81ykif83269x"))
(modules '((guix build utils)))
;; Avoid downloading toolchain.
(snippet '(substitute* "go.mod"
(("^toolchain.*") "")))))
(build-system go-build-system) (build-system go-build-system)
(arguments (arguments
(list #:go go-1.23 (list #:tests? (not (%current-target-system)) ;TODO: Run test suite.
#:go go-1.23
#:install-source? #f #:install-source? #f
#:tests? #f ;TODO #:import-path "."
#:import-path "code.gitea.io/gitea"
#:build-flags #:build-flags
#~(list (string-append #~(list (string-append
"-ldflags=" "-ldflags="
@ -149,40 +154,38 @@ pipelines, Hugo renders a complete site in seconds, often less.")
#:phases #:phases
#~(modify-phases %standard-phases #~(modify-phases %standard-phases
(replace 'unpack (replace 'unpack
(assoc-ref gnu:%standard-phases 'unpack)) (lambda args
(add-after 'unpack 'support-module
(lambda _
(unsetenv "GO111MODULE") (unsetenv "GO111MODULE")
(substitute* "go.mod" (apply (assoc-ref gnu:%standard-phases 'unpack) args)))
(("^toolchain.*") "")))) (replace 'install-license-files
(replace 'build (assoc-ref gnu:%standard-phases 'install-license-files))
(lambda* (#:key build-flags (parallel-build? #t) (add-after 'install 'rename-binary
#:allow-other-keys) (lambda _
(let* ((njobs (if parallel-build? (parallel-job-count) 1))) (rename-file (in-vicinity #$output "bin/gitea")
(setenv "GOMAXPROCS" (number->string njobs))) (in-vicinity #$output "bin/forgejo"))))
(apply invoke "go" "install" (add-after 'install 'install-extras
"-v" "-x"
"-ldflags=-s -w"
"-trimpath"
build-flags)))
(replace 'install
(lambda _ (lambda _
(mkdir-p (in-vicinity #$output "/etc/forgejo")) (mkdir-p (in-vicinity #$output "/etc/forgejo"))
(copy-file (copy-file "custom/conf/app.example.ini"
"custom/conf/app.example.ini"
(in-vicinity #$output "etc/forgejo/app.ini")) (in-vicinity #$output "etc/forgejo/app.ini"))
(for-each (for-each
(lambda (dir) (lambda (dir)
(copy-recursively (copy-recursively
dir (string-append #$output "/etc/forgejo/" dir))) dir (string-append #$output "/etc/forgejo/" dir)))
'("options" "public" "templates")) '("options" "public" "templates"))))
(with-directory-excursion (in-vicinity #$output "bin") (delete 'check)
(rename-file "gitea" "forgejo")))) (add-after 'install 'check
(replace 'install-license-files (lambda* (#:key tests? #:allow-other-keys)
(assoc-ref gnu:%standard-phases 'install-license-files))))) (when tests?
(let ((gitea (in-vicinity #$output "bin/gitea")))
(invoke gitea "--help")
(invoke gitea "--version"))))))))
(native-inputs (list git-minimal))
(home-page "https://forgejo.org/")
(synopsis "Lightweight software forge") (synopsis "Lightweight software forge")
(description (description
"Forgejo is a self-hosted lightweight software forge. Easy to install and "Forgejo is a self-hosted, lightweight software forge designed to
low maintenance, it just does the job.") facilitate collaborative software development. It is built to be easy to
(home-page "https://forgejo.org/") install and maintain, making it an ideal choice for teams and organizations
looking for a reliable platform to manage their software projects.")
(license license:gpl3+))) (license license:gpl3+)))