mirror of
https://gitlab.univ-nantes.fr/glicid-public/guix-glicid.git
synced 2025-04-29 21:58:36 +02:00
adding dirty forgejo package and a forgejo service
This commit is contained in:
parent
9802ae4595
commit
e54b61b7aa
2 changed files with 121 additions and 0 deletions
42
glicid/packages/forgejo.scm
Normal file
42
glicid/packages/forgejo.scm
Normal file
|
@ -0,0 +1,42 @@
|
|||
(define-module (glicid packages forgejo)
|
||||
#:use-module (guix)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module ((guix licenses) #:prefix license:)
|
||||
#:use-module (guix utils)
|
||||
#:use-module (guix download)
|
||||
#:use-module (guix packages)
|
||||
#:use-module (guix build-system trivial)
|
||||
#:use-module (gnu packages bash)
|
||||
#:use-module (gnu packages version-control))
|
||||
|
||||
(define-public forgejo-dirty
|
||||
(package
|
||||
(name "forgejo")
|
||||
(version "1.21.10-0")
|
||||
(source (origin
|
||||
(method url-fetch)
|
||||
(uri (string-append "https://codeberg.org/" name "/" name "/releases/download/v" version "/" name "-" version "-linux-amd64"))
|
||||
(file-name (string-append name "-" version "-linux-amd64"))
|
||||
(sha256 (base32 "1vkp2aipb5d1q4s77dhdwnj66ih3rvbx1bb3fgkvsknyhb1l8mna"))))
|
||||
(build-system trivial-build-system)
|
||||
(arguments
|
||||
'(#:modules ((guix build utils))
|
||||
#:builder (begin
|
||||
(use-modules (guix build utils))
|
||||
(let* ((source (assoc-ref %build-inputs "source"))
|
||||
(out (assoc-ref %outputs "out"))
|
||||
(install-dir (string-append out "/bin"))
|
||||
(executable (string-append install-dir "/forgejo"))
|
||||
(bash (string-append (assoc-ref %build-inputs "bash") "/bin/"))
|
||||
(git-dir (string-append (assoc-ref %build-inputs "git") "/bin/")))
|
||||
(setenv "PATH" (string-append (getenv "PATH") ":" bash))
|
||||
(mkdir-p install-dir)
|
||||
(copy-file source executable)
|
||||
(chmod executable #o755)
|
||||
(wrap-program executable `("PATH" ":" prefix (,git-dir)))))))
|
||||
(inputs (list git bash))
|
||||
(synopsis "Forgejo binary release")
|
||||
(description
|
||||
"Forgejo is a self-hosted lightweight software forge. Easy to install and low maintenance, it just does the job.")
|
||||
(home-page "https://forgejo.org/")
|
||||
(license license:expat)))
|
79
glicid/services/forgejo.scm
Normal file
79
glicid/services/forgejo.scm
Normal file
|
@ -0,0 +1,79 @@
|
|||
(define-module (glicid services forgejo)
|
||||
#:use-module (glicid packages forgejo)
|
||||
#:use-module (gnu services)
|
||||
#:use-module (gnu services shepherd)
|
||||
#:use-module (gnu system shadow)
|
||||
#:use-module (gnu system pam)
|
||||
#:use-module (gnu packages admin)
|
||||
#:use-module (gnu packages base)
|
||||
#:use-module (gnu packages certs)
|
||||
#:use-module (gnu packages version-control)
|
||||
#:use-module (guix gexp)
|
||||
#:use-module (guix modules)
|
||||
#:use-module (guix records)
|
||||
#:use-module (ice-9 match)
|
||||
#:export (forgejo-configuration
|
||||
forgejo-configuration?
|
||||
forgejo-service
|
||||
forgejo-service-type
|
||||
%forgejo-account
|
||||
%forgejo-group
|
||||
%forgejo-accounts))
|
||||
|
||||
(define %forgejo-group
|
||||
(user-group
|
||||
(name "forgejo")
|
||||
(system? #t)))
|
||||
|
||||
(define %forgejo-account
|
||||
(user-account
|
||||
(name "forgejo")
|
||||
(group "forgejo")
|
||||
(system? #t)
|
||||
(comment "forgejo server user")
|
||||
(home-directory "/var/lib/forgejo")
|
||||
(shell (file-append bash "/bin/bash"))))
|
||||
|
||||
(define %forgejo-accounts
|
||||
(list %forgejo-group %forgejo-account))
|
||||
|
||||
(define-record-type* <forgejo-configuration> forgejo-configuration
|
||||
make-forgejo-configuration
|
||||
forgejo-configuration?
|
||||
(forgejo forgejo (default forgejo))
|
||||
(forgejo-conf forgejo-conf (default "/etc/forgejo/app.ini"))
|
||||
(log-file log-file (default "/var/log/forgejo.log")))
|
||||
|
||||
(define %forgejo-activation
|
||||
#~(begin
|
||||
(mkdir-p "/etc/forgejo")
|
||||
(touch "/etc/forgejo/app.ini")
|
||||
(touch "/var/log/forgejo.log")
|
||||
(chown "/etc/forgejo" (passwd:uid "forgejo") (passwd:gid "forgejo"))
|
||||
(chown "/etc/forgejo/app.ini" (passwd:uid "forgejo") (passwd:gid "forgejo"))
|
||||
(chown "/var/log/forgejo.log" (passwd:uid "forgejo") (passwd:gid "forgejo"))
|
||||
#t))
|
||||
|
||||
|
||||
(define forgejo-service
|
||||
(match-lambda
|
||||
(($ <forgejo-configuration> forgejo forgejo-conf log-file)
|
||||
(list (shepherd-service (provision '(forgejo))
|
||||
(documentation "Run forgejo.")
|
||||
(requirement '(user-processes))
|
||||
(respawn? #t)
|
||||
(start #~(make-forkexec-constructor (list #$(file-append forgejo "/bin/forgejo")
|
||||
"web"
|
||||
"--config" forgejo-conf)
|
||||
#:log-file #$log-file
|
||||
#:user (passwd:uid (getpwnam "forgejo"))
|
||||
#:group (passwd:gid (getpwnam "forgejo"))))
|
||||
(stop #~(make-kill-destructor)))))))
|
||||
|
||||
(define forgejo-service-type
|
||||
(service-type (name 'forgejo)
|
||||
(extensions (list (service-extension shepherd-root-service-type forgejo-service)
|
||||
(service-extension activation-service-type (const %forgejo-activation))
|
||||
(service-extension account-service-type (const %forgejo-accounts))))
|
||||
(description "Run forgejo")
|
||||
))
|
Loading…
Add table
Reference in a new issue