Update gitile
modules/packages/gitile.scm
1 | - | ;;; GNU Guix --- Functional package management for GNU | |
2 | - | ;;; Copyright ?? 2020 Julien Lepiller <julien@lepiller.eu> | |
3 | - | ;;; | |
4 | - | ;;; This file is part of GNU Guix. | |
5 | - | ;;; | |
6 | - | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
7 | - | ;;; under the terms of the GNU General Public License as published by | |
8 | - | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
9 | - | ;;; your option) any later version. | |
10 | - | ;;; | |
11 | - | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
12 | - | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | - | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | - | ;;; GNU General Public License for more details. | |
15 | - | ;;; | |
16 | - | ;;; You should have received a copy of the GNU General Public License | |
17 | - | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
18 | - | ;;; | |
19 | - | ;;; Some of the help text was taken from the default dovecot.conf files. | |
1 | + | ;;;; Copyright (C) 2020, 2021 Julien Lepiller <julien@lepiller.eu> | |
2 | + | ;;;; | |
3 | + | ;;;; SPDX-License-Identifier: AGPL-3.0-or-later | |
4 | + | ;;;; | |
5 | + | ;;;; This program is free software: you can redistribute it and/or modify | |
6 | + | ;;;; it under the terms of the GNU Affero General Public License as published by | |
7 | + | ;;;; the Free Software Foundation, either version 3 of the License, or | |
8 | + | ;;;; (at your option) any later version. | |
9 | + | ;;;; | |
10 | + | ;;;; This program is distributed in the hope that it will be useful, | |
11 | + | ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | + | ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | + | ;;;; GNU Affero General Public License for more details. | |
14 | + | ;;;; | |
15 | + | ;;;; You should have received a copy of the GNU Affero General Public License | |
16 | + | ;;;; along with this program. If not, see <https://www.gnu.org/licenses/>. | |
17 | + | ;;;; | |
20 | 18 | ||
21 | 19 | (define-module (packages gitile) | |
20 | + | #:use-module (guix packages) | |
21 | + | #:use-module (guix licenses) | |
22 | + | #:use-module (guix build-system gnu) | |
23 | + | #:use-module (guix git-download) | |
24 | + | #:use-module (guix git) | |
22 | 25 | #:use-module (gnu packages autotools) | |
23 | 26 | #:use-module (gnu packages gnupg) | |
24 | 27 | #:use-module (gnu packages guile) | |
25 | 28 | #:use-module (gnu packages guile-xyz) | |
26 | 29 | #:use-module (gnu packages pkg-config) | |
27 | 30 | #:use-module (gnu packages texinfo) | |
28 | - | #:use-module (gnu packages tls) | |
29 | - | #:use-module (guix build-system gnu) | |
30 | - | #:use-module (guix git-download) | |
31 | - | #:use-module (guix packages) | |
32 | - | #:use-module (guix licenses)) | |
31 | + | #:use-module (gnu packages tls)) | |
33 | 32 | ||
34 | - | (define my-guile-git | |
33 | + | (define my-guile-syntax-highlight | |
35 | 34 | (package | |
36 | - | (inherit guile-git) | |
35 | + | (inherit guile-syntax-highlight) | |
37 | 36 | (source (origin | |
38 | 37 | (method git-fetch) | |
39 | 38 | (uri (git-reference | |
40 | - | (url "https://gitlab.com/roptat/guile-git") | |
41 | - | (commit "c39ab944d8004d3ab751a9e27336469afec081eb"))) | |
42 | - | (file-name (git-file-name "guile-git" "0.4.0.c39ab94")) | |
39 | + | (url "https://git.dthompson.us/guile-syntax-highlight.git") | |
40 | + | (commit "897fa5156ff41588e0d281eb00e4e94de63ccd8a"))) | |
41 | + | (file-name (git-file-name "guile-syntax-highlight" "0.1.897fa51")) | |
43 | 42 | (sha256 | |
44 | 43 | (base32 | |
45 | - | "0hknsv9r7pjahmxkvd7zpz93saki5kymh88xs6pb4h9d0ssp4fmp")))) | |
44 | + | "18zlg4mkgd3swgv2ggfz91ivnnzc0zhvc9ybgrxg1y762va9hyvj")))) | |
46 | 45 | (native-inputs | |
47 | 46 | `(("autoconf" ,autoconf) | |
48 | 47 | ("automake" ,automake) | |
49 | 48 | ("texinfo" ,texinfo) | |
50 | - | ,@(package-native-inputs guile-git))))) | |
49 | + | ,@(package-native-inputs guile-syntax-highlight))))) | |
51 | 50 | ||
52 | - | (define my-guile-syntax-highlight | |
51 | + | (define-public gitile | |
53 | 52 | (package | |
54 | - | (inherit guile-syntax-highlight) | |
53 | + | (name "gitile") | |
54 | + | (version "0.1.4") | |
55 | 55 | (source (origin | |
56 | 56 | (method git-fetch) | |
57 | 57 | (uri (git-reference | |
58 | - | (url "https://git.dthompson.us/guile-syntax-highlight.git") | |
59 | - | (commit "51727cbb7fc05ef743aab2d7b16314ea1ed790e4"))) | |
60 | - | (file-name (git-file-name "guile-syntax-highlight" "0.1.51727cb")) | |
58 | + | (url "https://git.lepiller.eu/git/gitile") | |
59 | + | (commit "aab4989efe4b5bcd3b1ac7fe108e1290de975fc0"))) | |
60 | + | (file-name (git-file-name name "0.1.4.aab4989")) | |
61 | 61 | (sha256 | |
62 | 62 | (base32 | |
63 | - | "1cvacy4y5qxajygb1qg8hvhjdf2xnnwnm5j918cabsi8wfwchig7")))) | |
63 | + | "0rslmrqspv32pbf9qz0glm8d3cxb1bz1sgi6ak2zl7blg25lw2l1")))) | |
64 | + | (build-system gnu-build-system) | |
65 | + | (arguments | |
66 | + | `(#:modules ((guix build utils) | |
67 | + | (guix build gnu-build-system) | |
68 | + | (ice-9 rdelim) | |
69 | + | (ice-9 popen)) | |
70 | + | #:make-flags (list "GUILE_AUTO_COMPILE=0") | |
71 | + | #:phases | |
72 | + | (modify-phases %standard-phases | |
73 | + | (add-after 'install-bin 'wrap-program | |
74 | + | (lambda* (#:key inputs outputs #:allow-other-keys) | |
75 | + | ;; Wrap the 'gitile' command to refer to the right modules. | |
76 | + | (let* ((out (assoc-ref outputs "out")) | |
77 | + | (commonmark (assoc-ref inputs "guile-commonmark")) | |
78 | + | (git (assoc-ref inputs "guile-git")) | |
79 | + | (bytes (assoc-ref inputs "guile-bytestructures")) | |
80 | + | (fibers (assoc-ref inputs "guile-fibers")) | |
81 | + | (gcrypt (assoc-ref inputs "guile-gcrypt")) | |
82 | + | (syntax-highlight (assoc-ref inputs "guile-syntax-highlight")) | |
83 | + | (deps (list out commonmark git bytes fibers gcrypt | |
84 | + | syntax-highlight)) | |
85 | + | (guile (assoc-ref %build-inputs "guile")) | |
86 | + | (effective (read-line | |
87 | + | (open-pipe* OPEN_READ | |
88 | + | (string-append guile "/bin/guile") | |
89 | + | "-c" "(display (effective-version))"))) | |
90 | + | (mods (string-drop-right ;drop trailing colon | |
91 | + | (string-join deps | |
92 | + | (string-append "/share/guile/site/" | |
93 | + | effective ":") | |
94 | + | 'suffix) | |
95 | + | 1)) | |
96 | + | (objs (string-drop-right | |
97 | + | (string-join deps | |
98 | + | (string-append "/lib/guile/" effective | |
99 | + | "/site-ccache:") | |
100 | + | 'suffix) | |
101 | + | 1))) | |
102 | + | (wrap-program (string-append out "/bin/gitile") | |
103 | + | `("GUILE_LOAD_PATH" ":" prefix (,mods)) | |
104 | + | `("GUILE_LOAD_COMPILED_PATH" ":" prefix (,objs))))))))) | |
105 | + | (propagated-inputs | |
106 | + | `(("guile-commonmark" ,guile-commonmark) | |
107 | + | ("guile-git" ,guile-git) | |
108 | + | ("guile-gcrypt" ,guile-gcrypt) | |
109 | + | ("guile-syntax-highlight" ,my-guile-syntax-highlight) | |
110 | + | ("gnutls" ,gnutls) | |
111 | + | ("guile-fibers" ,guile-fibers))) | |
64 | 112 | (native-inputs | |
65 | 113 | `(("autoconf" ,autoconf) | |
66 | 114 | ("automake" ,automake) | |
67 | - | ("texinfo" ,texinfo) | |
68 | - | ,@(package-native-inputs guile-syntax-highlight))))) | |
69 | - | ||
70 | - | (define-public gitile | |
71 | - | (let ((commit "fac1f0ccdbaca794451ae43526b1bbffacd8161a") | |
72 | - | (revision "0")) | |
73 | - | (package | |
74 | - | (name "gitile") | |
75 | - | (version (git-version "0.0" revision commit)) | |
76 | - | (source (origin | |
77 | - | (method git-fetch) | |
78 | - | (uri (git-reference | |
79 | - | (url "https://git.lepiller.eu/git/gitile") | |
80 | - | (commit commit))) | |
81 | - | (file-name (git-file-name name version)) | |
82 | - | (sha256 | |
83 | - | (base32 | |
84 | - | "048pm743gnxashggngw3zlsr13wf0k686n3j23czc4988gz7mfvp")))) | |
85 | - | (build-system gnu-build-system) | |
86 | - | (arguments | |
87 | - | `(#:modules ((guix build utils) | |
88 | - | (guix build gnu-build-system) | |
89 | - | (ice-9 rdelim) | |
90 | - | (ice-9 popen)) | |
91 | - | #:make-flags (list "GUILE_AUTO_COMPILE=0") | |
92 | - | #:phases | |
93 | - | (modify-phases %standard-phases | |
94 | - | (add-after 'install 'install-bin | |
95 | - | (lambda* (#:key outputs #:allow-other-keys) | |
96 | - | (install-file "scripts/gitile" | |
97 | - | (string-append (assoc-ref outputs "out") | |
98 | - | "/bin")) | |
99 | - | #t)) | |
100 | - | (add-after 'install-bin 'wrap-program | |
101 | - | (lambda* (#:key inputs outputs #:allow-other-keys) | |
102 | - | ;; Wrap the 'cuirass' command to refer to the right modules. | |
103 | - | (let* ((out (assoc-ref outputs "out")) | |
104 | - | (commonmark (assoc-ref inputs "guile-commonmark")) | |
105 | - | (git (assoc-ref inputs "guile-git")) | |
106 | - | (bytes (assoc-ref inputs "guile-bytestructures")) | |
107 | - | (fibers (assoc-ref inputs "guile-fibers")) | |
108 | - | (gcrypt (assoc-ref inputs "guile-gcrypt")) | |
109 | - | (syntax-highlight (assoc-ref inputs "guile-syntax-highlight")) | |
110 | - | (deps (list out commonmark git bytes fibers gcrypt | |
111 | - | syntax-highlight)) | |
112 | - | (guile (assoc-ref %build-inputs "guile")) | |
113 | - | (effective (read-line | |
114 | - | (open-pipe* OPEN_READ | |
115 | - | (string-append guile "/bin/guile") | |
116 | - | "-c" "(display (effective-version))"))) | |
117 | - | (mods (string-drop-right ;drop trailing colon | |
118 | - | (string-join deps | |
119 | - | (string-append "/share/guile/site/" | |
120 | - | effective ":") | |
121 | - | 'suffix) | |
122 | - | 1)) | |
123 | - | (objs (string-drop-right | |
124 | - | (string-join deps | |
125 | - | (string-append "/lib/guile/" effective | |
126 | - | "/site-ccache:") | |
127 | - | 'suffix) | |
128 | - | 1))) | |
129 | - | (wrap-program (string-append out "/bin/gitile") | |
130 | - | `("GUILE_LOAD_PATH" ":" prefix (,mods)) | |
131 | - | `("GUILE_LOAD_COMPILED_PATH" ":" prefix (,objs))) | |
132 | - | #t)))))) | |
133 | - | (native-inputs | |
134 | - | `(("autoconf" ,autoconf) | |
135 | - | ("automake" ,automake) | |
136 | - | ("guile" ,guile-3.0) | |
137 | - | ("pkg-config" ,pkg-config))) | |
138 | - | (inputs | |
139 | - | `(("guile" ,guile-3.0) | |
140 | - | ("guile-commonmark" ,guile-commonmark) | |
141 | - | ("guile-fibers" ,guile-fibers) | |
142 | - | ("guile-gcrypt" ,guile-gcrypt) | |
143 | - | ("guile-git" ,my-guile-git) | |
144 | - | ("guile-syntax-highlight" ,my-guile-syntax-highlight) | |
145 | - | ("gnutls" ,gnutls))) | |
146 | - | (home-page "") | |
147 | - | (synopsis "") | |
148 | - | (description "") | |
149 | - | (license gpl3+)))) | |
115 | + | ("libtool" ,libtool) | |
116 | + | ("pkg-config" ,pkg-config) | |
117 | + | ("guile" ,guile-3.0))) | |
118 | + | (home-page "https://git.lepiller.eu") | |
119 | + | (synopsis "Simple git forge written in Guile") | |
120 | + | (description "Gitile is a git forge written in Guile that lets you | |
121 | + | visualize your public Git repositories on a web interface.") | |
122 | + | (license agpl3+))) | |
150 | 123 | ||
151 | 124 | gitile |
modules/services/gitile.scm
1 | 1 | ;;; GNU Guix --- Functional package management for GNU | |
2 | - | ;;; Copyright ?? 2020 Julien Lepiller <julien@lepiller.eu> | |
2 | + | ;;; Copyright ?? 2020, 2021 Julien Lepiller <julien@lepiller.eu> | |
3 | 3 | ;;; | |
4 | 4 | ;;; This file is part of GNU Guix. | |
5 | 5 | ;;; | |
… | |||
23 | 23 | #:use-module (gnu services base) | |
24 | 24 | #:use-module (gnu services configuration) | |
25 | 25 | #:use-module (gnu services shepherd) | |
26 | + | #:use-module (gnu services web) | |
26 | 27 | #:use-module (gnu system pam) | |
27 | 28 | #:use-module (gnu system shadow) | |
28 | 29 | #:use-module (gnu packages admin) | |
… | |||
44 | 45 | (database gitile-configuration-database | |
45 | 46 | (default "/var/lib/gitile/gitile-db.sql")) | |
46 | 47 | (repositories gitile-configuration-repositories | |
47 | - | (default "/var/lib/gitolite/repositories"))) | |
48 | + | (default "/var/lib/gitolite/repositories")) | |
49 | + | (base-git-url gitile-configuration-base-git-url) | |
50 | + | (index-title gitile-configuration-index-title | |
51 | + | (default "Index")) | |
52 | + | (intro gitile-configuration-intro | |
53 | + | (default '())) | |
54 | + | (footer gitile-configuration-footer | |
55 | + | (default '())) | |
56 | + | (nginx gitile-configuration-nginx)) | |
48 | 57 | ||
49 | - | (define (gitile-config-file host port database repositories) | |
58 | + | (define (gitile-config-file host port database repositories base-git-url | |
59 | + | index-title intro footer) | |
50 | 60 | (define build | |
51 | 61 | #~(write `(config | |
52 | 62 | (port #$port) | |
53 | 63 | (host #$host) | |
54 | 64 | (database #$database) | |
55 | - | (repositories #$repositories)) | |
65 | + | (repositories #$repositories) | |
66 | + | (base-git-url #$base-git-url) | |
67 | + | (index-title #$index-title) | |
68 | + | (intro #$intro) | |
69 | + | (footer #$footer)) | |
56 | 70 | (open-output-file #$output))) | |
57 | 71 | ||
58 | 72 | (computed-file "gitile.conf" build)) | |
59 | 73 | ||
74 | + | (define gitile-nginx-server-block | |
75 | + | (match-lambda | |
76 | + | (($ <gitile-configuration> package host port database repositories | |
77 | + | base-git-url index-title intro footer nginx) | |
78 | + | (list (nginx-server-configuration | |
79 | + | (inherit nginx) | |
80 | + | (locations | |
81 | + | (append | |
82 | + | (list | |
83 | + | (nginx-location-configuration | |
84 | + | (uri "/") | |
85 | + | (body | |
86 | + | (list | |
87 | + | #~(string-append "proxy_pass http://" #$host | |
88 | + | ":" (number->string #$port) | |
89 | + | "/;"))))) | |
90 | + | (map | |
91 | + | (lambda (loc) | |
92 | + | (nginx-location-configuration | |
93 | + | (uri loc) | |
94 | + | (body | |
95 | + | (list | |
96 | + | #~(string-append "root " #$package "/share/gitile/assets;"))))) | |
97 | + | '("/css" "/js" "/images")) | |
98 | + | (nginx-server-configuration-locations nginx)))))))) | |
99 | + | ||
60 | 100 | (define gitile-shepherd-service | |
61 | 101 | (match-lambda | |
62 | - | (($ <gitile-configuration> package host port database repositories) | |
102 | + | (($ <gitile-configuration> package host port database repositories | |
103 | + | base-git-url index-title intro footer nginx) | |
63 | 104 | (list (shepherd-service | |
64 | 105 | (provision '(gitile)) | |
65 | 106 | (requirement '(loopback)) | |
… | |||
68 | 109 | #~(make-forkexec-constructor | |
69 | 110 | `(,#$gitile "-c" #$(gitile-config-file | |
70 | 111 | host port database | |
71 | - | repositories)) | |
112 | + | repositories | |
113 | + | base-git-url index-title | |
114 | + | intro footer)) | |
72 | 115 | #:user "gitile" | |
73 | 116 | #:group "git"))) | |
74 | 117 | (stop #~(make-kill-destructor))))))) | |
… | |||
89 | 132 | (list (service-extension account-service-type | |
90 | 133 | (const %gitile-accounts)) | |
91 | 134 | (service-extension shepherd-root-service-type | |
92 | - | gitile-shepherd-service))) | |
93 | - | (default-value | |
94 | - | (gitile-configuration)))) | |
135 | + | gitile-shepherd-service) | |
136 | + | (service-extension nginx-service-type | |
137 | + | gitile-nginx-server-block))))) |