guix.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 | (use-modules (guix packages) |
20 | (guix licenses) |
21 | (guix build-system gnu) |
22 | (guix git-download) |
23 | (guix git) |
24 | (gnu packages autotools) |
25 | (gnu packages gnupg) |
26 | (gnu packages guile) |
27 | (gnu packages guile-xyz) |
28 | (gnu packages pkg-config) |
29 | (gnu packages texinfo) |
30 | (gnu packages tls)) |
31 | |
32 | (define my-guile-syntax-highlight |
33 | (package |
34 | (inherit guile-syntax-highlight) |
35 | (source (origin |
36 | (method git-fetch) |
37 | (uri (git-reference |
38 | (url "https://git.dthompson.us/guile-syntax-highlight.git") |
39 | (commit "897fa5156ff41588e0d281eb00e4e94de63ccd8a"))) |
40 | (file-name (git-file-name "guile-syntax-highlight" "0.1.897fa51")) |
41 | (sha256 |
42 | (base32 |
43 | "18zlg4mkgd3swgv2ggfz91ivnnzc0zhvc9ybgrxg1y762va9hyvj")))) |
44 | (native-inputs |
45 | `(("autoconf" ,autoconf) |
46 | ("automake" ,automake) |
47 | ("texinfo" ,texinfo) |
48 | ,@(package-native-inputs guile-syntax-highlight))))) |
49 | |
50 | (package |
51 | (name "gitile") |
52 | (version "0.1") |
53 | (source (git-checkout (url (dirname (current-filename))))) |
54 | (build-system gnu-build-system) |
55 | (arguments |
56 | `(#:modules ((guix build utils) |
57 | (guix build gnu-build-system) |
58 | (ice-9 rdelim) |
59 | (ice-9 popen)) |
60 | #:make-flags (list "GUILE_AUTO_COMPILE=0") |
61 | #:phases |
62 | (modify-phases %standard-phases |
63 | (add-after 'install-bin 'wrap-program |
64 | (lambda* (#:key inputs outputs #:allow-other-keys) |
65 | ;; Wrap the 'gitile' command to refer to the right modules. |
66 | (let* ((out (assoc-ref outputs "out")) |
67 | (commonmark (assoc-ref inputs "guile-commonmark")) |
68 | (git (assoc-ref inputs "guile-git")) |
69 | (bytes (assoc-ref inputs "guile-bytestructures")) |
70 | (fibers (assoc-ref inputs "guile-fibers")) |
71 | (gcrypt (assoc-ref inputs "guile-gcrypt")) |
72 | (syntax-highlight (assoc-ref inputs "guile-syntax-highlight")) |
73 | (deps (list out commonmark git bytes fibers gcrypt |
74 | syntax-highlight)) |
75 | (guile (assoc-ref %build-inputs "guile")) |
76 | (effective (read-line |
77 | (open-pipe* OPEN_READ |
78 | (string-append guile "/bin/guile") |
79 | "-c" "(display (effective-version))"))) |
80 | (mods (string-drop-right ;drop trailing colon |
81 | (string-join deps |
82 | (string-append "/share/guile/site/" |
83 | effective ":") |
84 | 'suffix) |
85 | 1)) |
86 | (objs (string-drop-right |
87 | (string-join deps |
88 | (string-append "/lib/guile/" effective |
89 | "/site-ccache:") |
90 | 'suffix) |
91 | 1))) |
92 | (wrap-program (string-append out "/bin/gitile") |
93 | `("GUILE_LOAD_PATH" ":" prefix (,mods)) |
94 | `("GUILE_LOAD_COMPILED_PATH" ":" prefix (,objs))))))))) |
95 | (propagated-inputs |
96 | `(("guile-commonmark" ,guile-commonmark) |
97 | ("guile-git" ,guile-git) |
98 | ("guile-gcrypt" ,guile-gcrypt) |
99 | ("guile-syntax-highlight" ,my-guile-syntax-highlight) |
100 | ("gnutls" ,gnutls) |
101 | ("guile-fibers" ,guile-fibers))) |
102 | (native-inputs |
103 | `(("autoconf" ,autoconf) |
104 | ("automake" ,automake) |
105 | ("libtool" ,libtool) |
106 | ("pkg-config" ,pkg-config) |
107 | ("guile" ,guile-3.0))) |
108 | (home-page "https://git.lepiller.eu") |
109 | (synopsis "") |
110 | (description "") |
111 | (license gpl3+)) |
112 |