guix.scm 1.73 KB
Newer Older
Ludovic Courtès's avatar
Ludovic Courtès committed
1 2 3
;;; This module is part of Guix-HPC and is licensed under the same terms,
;;; those of the GNU GPL version 3 or (at your option) any later version.
;;;
4
;;; Copyright © 2017, 2019 Inria
Ludovic Courtès's avatar
Ludovic Courtès committed
5 6 7 8 9 10 11 12 13 14 15 16 17

;; Run 'guix build -f guix.scm' to build the web site.

(use-modules (guix) (gnu)
             (guix modules)
             (guix git-download))

(define haunt
  (specification->package "haunt"))

(define guile-commonmark
  (specification->package "guile-commonmark"))

18 19 20
(define guile-syntax-highlight
  (specification->package "guile-syntax-highlight"))

21 22 23
(define this-directory
  (dirname (current-filename)))

Ludovic Courtès's avatar
Ludovic Courtès committed
24
(define source
25
  (local-file this-directory "guix-hpc-web"
Ludovic Courtès's avatar
Ludovic Courtès committed
26
              #:recursive? #t
27
              #:select? (git-predicate this-directory)))
Ludovic Courtès's avatar
Ludovic Courtès committed
28

29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
(define build
  (with-imported-modules (source-module-closure
                          '((guix build utils)))
    #~(begin
        (use-modules (guix build utils))

        (copy-recursively #$source ".")

        ;; For Haunt.
        (setenv "GUILE_LOAD_PATH"
                (string-append
                 #+(file-append guile-commonmark
                                "/share/guile/site/2.2")
                 ":"
                 #+(file-append guile-syntax-highlight
                                "/share/guile/site/2.2")))

        ;; So we can read/write UTF-8 files.
        (setenv "GUIX_LOCPATH"
                #+(file-append (specification->package "glibc-utf8-locales")
                               "/lib/locale"))
        (setenv "LC_ALL" "en_US.utf8")

        (and (zero? (system* #+(file-append haunt "/bin/haunt")
                             "build"))
             (begin
               (mkdir-p #$output)
               (copy-recursively "site" #$output))))))

(computed-file "guix-hpc-web-site" build)