summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--guix-web/view.scm27
1 files changed, 26 insertions, 1 deletions
diff --git a/guix-web/view.scm b/guix-web/view.scm
index 35cce29..6898c28 100644
--- a/guix-web/view.scm
+++ b/guix-web/view.scm
@@ -16,7 +16,9 @@
;;; <http://www.gnu.org/licenses/>.
(define-module (guix-web view)
+ #:use-module (ice-9 match)
#:use-module (json)
+ #:use-module (web uri)
#:use-module (guix licenses)
#:use-module (guix packages)
#:use-module (gnu packages)
@@ -100,7 +102,26 @@
`((div (@ (id "guix")) "")
,@(map script-tag javascripts))))
+;; This should be moved client-side and the server should just serve
+;; the relevant JSON.
(define (view-package name)
+ (define (describe-inputs package package-inputs description)
+ (define (describe-input input)
+ (match input
+ ((_ input)
+ `(li
+ (a (@ (href ,(string-append
+ "/"
+ (encode-and-join-uri-path
+ `("package" ,(package-name input))))))
+ ,(string-append (package-name input) " "
+ (package-version input)))))))
+ (let ((inputs (package-inputs package)))
+ (if (null? inputs)
+ '()
+ `((dt ,description)
+ (dd (ul ,@(map describe-input inputs)))))))
+
(define (describe-package package)
`(dl
(dt "Version")
@@ -110,7 +131,11 @@
(dt "Description")
(dd ,(package-description package))
(dt "License")
- (dd ,(render-package-license package))))
+ (dd ,(render-package-license package))
+ ,@(describe-inputs package package-inputs "Inputs")
+ ,@(describe-inputs package package-native-inputs "Native Inputs")
+ ,@(describe-inputs package package-propagated-inputs
+ "Propagated Inputs")))
(let ((packages (find-packages-by-name name)))
(define (format-package-count)