system-configuration/modules/packages/gitile.scm

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) #:prefix license:)
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
  (let ((commit "aab4989efe4b5bcd3b1ac7fe108e1290de975fc0")
53
	(revision "0"))
54
    (package
55
      (name "gitile")
56
      (version (git-version "0.1.4" revision commit))
57
      (source
58
       (origin
59
         (method git-fetch)
60
         (uri (git-reference
61
                (url "https://git.lepiller.eu/git/gitile")
62
                (commit commit)))
63
         (file-name (git-file-name name version))
64
         (sha256
65
          (base32 "0rslmrqspv32pbf9qz0glm8d3cxb1bz1sgi6ak2zl7blg25lw2l1"))))
66
      (build-system gnu-build-system)
67
      (arguments
68
       `(#:imported-modules ((guix build guile-build-system)
69
                             ,@%gnu-build-system-modules)
70
         #:make-flags (list "GUILE_AUTO_COMPILE=0")
71
         #:phases
72
         (modify-phases %standard-phases
73
           (replace 'bootstrap
74
             (lambda _
75
               ;; The 'bootstrap' script lacks a shebang, leading to "Exec
76
               ;; format error" with glibc 2.35.
77
               (invoke "autoreconf" "-vfi")))
78
           (add-after 'install-bin 'wrap-program
79
             (lambda* (#:key inputs outputs #:allow-other-keys)
80
               (use-modules (guix build guile-build-system))
81
               ;; Wrap the 'gitile' command to refer to the right modules.
82
               (let* ((out    (assoc-ref outputs "out"))
83
                      (commonmark (assoc-ref inputs "guile-commonmark"))
84
                      (git    (assoc-ref inputs "guile-git"))
85
                      (bytes  (assoc-ref inputs "guile-bytestructures"))
86
                      (fibers (assoc-ref inputs "guile-fibers"))
87
                      (gcrypt (assoc-ref inputs "guile-gcrypt"))
88
                      (syntax-highlight (assoc-ref inputs "guile-syntax-highlight"))
89
                      (deps   (list out commonmark git bytes fibers gcrypt
90
                                    syntax-highlight))
91
                      (guile  (assoc-ref inputs "guile"))
92
                      (effective (target-guile-effective-version))
93
                      (mods   (string-drop-right  ;drop trailing colon
94
                               (string-join deps
95
                                            (string-append "/share/guile/site/"
96
                                                           effective ":")
97
                                            'suffix)
98
                               1))
99
                      (objs   (string-drop-right
100
                               (string-join deps
101
                                            (string-append "/lib/guile/" effective
102
                                                           "/site-ccache:")
103
                                            'suffix)
104
                               1)))
105
                 (wrap-program (string-append out "/bin/gitile")
106
                   `("GUILE_LOAD_PATH" ":" prefix (,mods))
107
                   `("GUILE_LOAD_COMPILED_PATH" ":" prefix (,objs)))))))))
108
      (native-inputs
109
       (list autoconf automake guile-3.0 pkg-config))
110
      (inputs
111
       (list guile-3.0
112
             guile-commonmark
113
             guile-fibers-1.3
114
             guile-gcrypt
115
             guile-git
116
             guile-syntax-highlight-for-gitile
117
             guile-gnutls))
118
      (home-page "https://git.lepiller.eu/gitile")
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 license:agpl3+))))
123
124
gitile
125