gitile.scm
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 | ;;;; |
18 | |
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) |
25 | #:use-module (gnu packages autotools) |
26 | #:use-module (gnu packages gnupg) |
27 | #:use-module (gnu packages guile) |
28 | #:use-module (gnu packages guile-xyz) |
29 | #:use-module (gnu packages pkg-config) |
30 | #:use-module (gnu packages texinfo) |
31 | #:use-module (gnu packages tls)) |
32 | |
33 | (define my-guile-syntax-highlight |
34 | (package |
35 | (inherit guile-syntax-highlight) |
36 | (source (origin |
37 | (method git-fetch) |
38 | (uri (git-reference |
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")) |
42 | (sha256 |
43 | (base32 |
44 | "18zlg4mkgd3swgv2ggfz91ivnnzc0zhvc9ybgrxg1y762va9hyvj")))) |
45 | (native-inputs |
46 | `(("autoconf" ,autoconf) |
47 | ("automake" ,automake) |
48 | ("texinfo" ,texinfo) |
49 | ,@(package-native-inputs guile-syntax-highlight))))) |
50 | |
51 | (define-public gitile |
52 | (package |
53 | (name "gitile") |
54 | (version "0.1.4") |
55 | (source (origin |
56 | (method git-fetch) |
57 | (uri (git-reference |
58 | (url "https://git.lepiller.eu/git/gitile") |
59 | (commit "aab4989efe4b5bcd3b1ac7fe108e1290de975fc0"))) |
60 | (file-name (git-file-name name "0.1.4.aab4989")) |
61 | (sha256 |
62 | (base32 |
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))) |
112 | (native-inputs |
113 | `(("autoconf" ,autoconf) |
114 | ("automake" ,automake) |
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+))) |
123 | |
124 | gitile |
125 |