guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03/03: website: Rewrite '.guix.scm'.


From: Ludovic Courtès
Subject: 03/03: website: Rewrite '.guix.scm'.
Date: Fri, 5 Jul 2019 06:29:05 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix-artwork.

commit 62a9db1dc50a1580d1bafc47f9e347ad2d10e1ee
Author: Ludovic Courtès <address@hidden>
Date:   Fri Jul 5 12:27:34 2019 +0200

    website: Rewrite '.guix.scm'.
    
    * website/.guix.scm (let-package): Remove.
    (package+propagated-inputs): New procedures.
    (build): New variable.
    Return a computed file.
---
 website/.guix.scm | 72 +++++++++++++++++++++++++++----------------------------
 1 file changed, 36 insertions(+), 36 deletions(-)

diff --git a/website/.guix.scm b/website/.guix.scm
index 8d99c65..06ddbd0 100644
--- a/website/.guix.scm
+++ b/website/.guix.scm
@@ -31,47 +31,47 @@
               #:recursive? #t
               #:select? (git-predicate this-directory)))
 
-(define-syntax let-package
-  (syntax-rules ()
-    ((_ () body ...)
-     (begin body ...))
-    ((_ ((var name) rest ...) body ...)
-     (let ((var (specification->package name)))
-       (let-package (rest ...) body ...)))))
+(define (package+propagated-inputs package)
+  (match (package-transitive-propagated-inputs package)
+    (((labels packages) ...)
+     (cons package packages))))
 
-(let-package ((guix "guix")
-              (guile-json "guile-json")
-              (haunt "haunt")
-              (guile-commonmark "guile-commonmark")
-              (guile-syntax-highlight "guile-syntax-highlight"))
-  (with-imported-modules (source-module-closure
-                          '((guix build utils)))
-    #~(begin
-        (use-modules (guix build utils))
+(define build
+  (with-extensions (append (package+propagated-inputs
+                            (specification->package "guix"))
+                           (package+propagated-inputs
+                            (specification->package "guile-syntax-highlight")))
+    (with-imported-modules (source-module-closure
+                            '((guix build utils)))
+      #~(begin
+          (use-modules (guix build utils))
 
-        (copy-recursively #$source ".")
+          (copy-recursively #$source ".")
 
-        ;; For Haunt.
-        (setenv "GUILE_LOAD_PATH"
-                (string-join (list #+guile-commonmark #+guile-json
-                                   #+guile-syntax-highlight
-                                   #+guix)
-                             "/share/guile/site/2.2:"
-                             'suffix))
-        (setenv "GUILE_LOAD_COMPILED_PATH"
-                #+(file-append guix "/lib/guile/2.2/site-ccache"))
+          ;; For Haunt.
+          (setenv "GUILE_LOAD_PATH" (string-join %load-path ":"))
+          (setenv "GUILE_LOAD_COMPILED_PATH"
+                  (string-join %load-compiled-path ":"))
 
-        ;; 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")
+          ;; 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))))))
+          ;; Use a sane default.
+          (setenv "XDG_CACHE_HOME" "/tmp/.cache")
+
+          ;; Choose the layout for guix.gnu.org.
+          (setenv "GUIX_WEB_SITE_INFO" "t")
+
+          (when (zero? (system* #+(file-append (specification->package "haunt")
+                                               "/bin/haunt")
+                                "build"))
+            (mkdir-p #$output)
+            (copy-recursively "/tmp/gnu.org/software/guix" #$output))))))
+
+(computed-file "guix-web-site" build)
 
 ;; Local Variables:
 ;; eval: (put 'let-package 'scheme-indent-function 1)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]