summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xhipis.scm (renamed from hipis/hipis.scm)4
-rw-r--r--hipis/packages/source/hwp/hwp-build8
-rw-r--r--hipis/packages/source/hwp/hwp.scm13
-rw-r--r--hipis/packages/source/hwp/hwp/site.scm32
-rw-r--r--hipis/packages/source/hwp/hwp/ui.scm17
-rw-r--r--hipis/packages/web.scm90
-rw-r--r--hipis/services/web.scm76
7 files changed, 240 insertions, 0 deletions
diff --git a/hipis/hipis.scm b/hipis.scm
index 3660782..6cd5654 100755
--- a/hipis/hipis.scm
+++ b/hipis.scm
@@ -156,6 +156,10 @@
156 (ssl-certificate-key (letsencrypt-key "jdlugosz.com")) 156 (ssl-certificate-key (letsencrypt-key "jdlugosz.com"))
157 (root "/srv/http/jdlugosz.com")))))) 157 (root "/srv/http/jdlugosz.com"))))))
158 158
159 (service hwp-service-type
160 (hwp-site-configuration
161 (name "hwp-base")))
162
159 (modify-services %base-services 163 (modify-services %base-services
160 (delete static-networking-service-type)))) 164 (delete static-networking-service-type))))
161 165
diff --git a/hipis/packages/source/hwp/hwp-build b/hipis/packages/source/hwp/hwp-build
new file mode 100644
index 0000000..cf1e97e
--- /dev/null
+++ b/hipis/packages/source/hwp/hwp-build
@@ -0,0 +1,8 @@
1#!/usr/bin/guile --no-auto-compile
2-*- scheme -*-
3!#
4
5(use-modules (hwp))
6
7(hwp-run (command-line))
8
diff --git a/hipis/packages/source/hwp/hwp.scm b/hipis/packages/source/hwp/hwp.scm
new file mode 100644
index 0000000..6770b5b
--- /dev/null
+++ b/hipis/packages/source/hwp/hwp.scm
@@ -0,0 +1,13 @@
1(define-module (hwp)
2 #:use-module (hwp site)
3 #:use-module (hwp ui)
4 #:use-module (ice-9 match)
5 #:export (hwp-run))
6
7(define (hwp-run args)
8 (match args
9 ((cmd)
10 (display "To create site: hwp-build [input-path] [output-path]")
11 (newline))
12 ((cmd in out)
13 (hipis-site in out))))
diff --git a/hipis/packages/source/hwp/hwp/site.scm b/hipis/packages/source/hwp/hwp/site.scm
new file mode 100644
index 0000000..7fdb2f0
--- /dev/null
+++ b/hipis/packages/source/hwp/hwp/site.scm
@@ -0,0 +1,32 @@
1(define-module (hwp site)
2 #:use-module (haunt asset)
3 #:use-module (haunt builder blog)
4 #:use-module (haunt builder atom)
5 #:use-module (haunt builder assets)
6 #:use-module (haunt reader commonmark)
7 #:use-module (haunt site)
8
9 #:use-module (ice-9 match)
10
11 #:export (hipis-site))
12
13
14(define (hipis-site site-directory build-directory)
15 (build-site
16 (site #:title "Built with Guile"
17 #:domain "jdlugosz.com"
18 #:default-metadata
19 '((author . "Jakub Długosz")
20 (email . "jdlugosz963@gmail.com"))
21 #:readers (list commonmark-reader)
22 #:builders (list (blog)
23 (atom-feed)
24 (atom-feeds-by-tag)
25 (static-directory (string-append site-directory
26 "/assets/images")
27 "/assets/images"))
28 #:build-directory build-directory
29 #:posts-directory (string-append site-directory
30 "/posts"))))
31
32
diff --git a/hipis/packages/source/hwp/hwp/ui.scm b/hipis/packages/source/hwp/hwp/ui.scm
new file mode 100644
index 0000000..ec11a31
--- /dev/null
+++ b/hipis/packages/source/hwp/hwp/ui.scm
@@ -0,0 +1,17 @@
1(define-module (hwp ui)
2 #:use-module (srfi srfi-9))
3
4(define-record-type <theme-configuration>
5 (make-theme-configuration primary-color
6 secondary-color)
7 theme-configuration?
8 (primary-color theme-configuration-primary-color)
9 (secondary-color theme-configuration-secondary-color))
10
11
12(define* (theme-configuration #:key
13 (primary-color "#000")
14 (secondary-color "#111"))
15 (make-theme-configuration primary-color
16 secondary-color))
17
diff --git a/hipis/packages/web.scm b/hipis/packages/web.scm
new file mode 100644
index 0000000..e4f4f6c
--- /dev/null
+++ b/hipis/packages/web.scm
@@ -0,0 +1,90 @@
1(define-module (hipis packages web)
2 #:use-module ((guix licenses) #:prefix license:)
3 #:use-module (guix packages)
4 #:use-module (guix profiles)
5 #:use-module (guix gexp)
6 #:use-module (guix build-system copy)
7 #:use-module (guix build-system guile)
8
9 #:use-module (gnu packages)
10 #:use-module (guix download)
11 #:use-module (gnu packages python-xyz)
12 #:use-module (gnu packages python-web)
13 #:use-module (gnu packages python-crypto)
14 #:use-module (gnu packages python-check)
15 #:use-module (gnu packages check)
16 #:use-module (gnu packages guile-xyz)
17 #:use-module (gnu packages guile)
18 #:use-module (guix git-download)
19 ) ;; (guix utils)
20
21(define-public hipis-web-site
22 (package
23 (name "emacs-hipis-web-site")
24 (version "1.0")
25 (synopsis "Build scripts to *.jdlugosz.com pages.")
26 (description "Build scripts to *.jdlugosz.com pages.")
27 (home-page "https://git.jdlugosz.com/hipis/hipis-system/")
28 (source
29 (local-file "/home/jakub/Projects/hipis/hipis/packages/source/hwp" #:recursive? #t))
30 (build-system guile-build-system)
31
32 (arguments
33 `(#:phases (modify-phases %standard-phases
34 (add-before 'install 'move-files
35 (lambda* (#:key inputs outputs #:allow-other-keys)
36 (let* ((out (assoc-ref outputs "out"))
37 (bin (string-append out "/bin/"))
38 (haunt (assoc-ref inputs "haunt"))
39 (hwp "hwp-build"))
40 (mkdir-p bin)
41 (chmod hwp #o555)
42 (copy-recursively hwp (string-append bin hwp))
43 (delete-file-recursively hwp))))
44
45 (add-before 'install 'wrap-hipis-build-web-page
46 (lambda* (#:key inputs outputs #:allow-other-keys)
47 (let* ((out (assoc-ref outputs "out"))
48 (bin (string-append out "/bin"))
49 (deps (list (assoc-ref inputs "haunt")
50 (assoc-ref inputs "guile-commonmark")
51 (assoc-ref inputs "guile-reader")
52 out)))
53 (wrap-program (string-append bin "/hwp-build")
54 #:sh "/bin/sh"
55 `("GUILE_LOAD_PATH" ":" prefix
56 (,@(map (lambda (dep)
57 (string-append dep
58 "/share/guile/site/3.0/"))
59 deps)))
60 `("GUILE_LOAD_COMPILED_PATH" ":" prefix
61 (,@(map (lambda (dep)
62 (string-append dep
63 "/lib/guile/3.0/site-ccache"))
64 deps))))))))))
65
66 ;; (native-inputs (list haunt))
67 (inputs (list guile-3.0
68 guile-reader
69 guile-commonmark))
70 (propagated-inputs (list haunt))
71 (license license:gpl3+)))
72
73
74;; (use-modules (guix store)
75;; (guix derivations))
76
77;; (define (test-hipis-web-site-pacakge)
78;; (let* ((con (open-connection))
79;; (drv (run-with-store con (package->derivation hipis-web-site)))
80;; (drv-file-name (derivation-file-name drv))
81;; (drv-output-path (derivation->output-path drv)))
82;; (build-things con (list drv-file-name))
83;; drv-output-path))
84
85;; (test-hipis-web-site-pacakge)
86
87
88(packages->manifest
89 (list hipis-web-site
90 guile-3.0-latest))
diff --git a/hipis/services/web.scm b/hipis/services/web.scm
new file mode 100644
index 0000000..52cc6db
--- /dev/null
+++ b/hipis/services/web.scm
@@ -0,0 +1,76 @@
1(define-module (hipis services web)
2 #:use-module ((guix licenses) #:prefix license:)
3 #:use-module (guix packages)
4 #:use-module (guix profiles)
5 #:use-module (guix gexp)
6 #:use-module (guix build-system copy)
7 #:use-module (guix build-system guile)
8 #:use-module (guix records)
9
10 #:use-module (gnu packages)
11 #:use-module (guix download)
12 #:use-module (gnu packages python-xyz)
13 #:use-module (gnu packages python-web)
14 #:use-module (gnu packages python-crypto)
15 #:use-module (gnu packages python-check)
16 #:use-module (gnu packages check)
17 #:use-module (gnu packages guile-xyz)
18 #:use-module (gnu packages guile)
19 #:use-module (guix git-download)
20 #:use-module (gnu services)
21 #:use-module (gnu services guix)
22 #:use-module (hipis packages web)
23
24 #:export (hwp-service-type
25 hwp-theme-configuration
26 hwp-site-configuration))
27
28
29(define-record-type* <hwp-theme-configuration>
30 hwp-theme-configuration make-hwp-theme-configuration
31 hwp-theme-configuration-configuration?
32 (primary-color hwp-theme-configuration-primary-color
33 (default "#000")))
34
35(define-record-type* <hwp-site-configuration>
36 hwp-site-configuration make-hwp-theme-configuration
37 hwp-site-configuration-configuration?
38 (name hwp-site-configuration-name)
39 (theme hwp-site-configuration-theme
40 (default #nil)))
41
42
43(define (make-hwp-start-script config)
44 (match-record config <hwp-site-configuration>
45 (name)
46 (program-file (string-append "hwp-" name)
47 (with-extensions (cons
48 hipis-web-site
49 (map cadr
50 (append (package-inputs hipis-web-site)
51 (package-propagated-inputs hipis-web-site))))
52 #~(begin
53 (use-modules (hwp))
54 (hwp-run '(_ "/tmp/in" "/tmp/out")))))))
55
56(define (hwp-activation config)
57 (match-record config <hwp-site-configuration>
58 (name theme)
59 (let* ((hwp-directory "/var/lib/hwp")
60 (hwp-site-script (string-append hwp-directory "/hwp-" name))
61 (message (string-append "Script for building websites is generated in: "
62 hwp-site-script)))
63 (with-imported-modules '((guix build utils))
64 #~(begin
65 (use-modules (guix build utils))
66 (mkdir-p #$hwp-directory)
67 (copy-file #$(make-hwp-start-script config) #$hwp-site-script)
68 (display #$message))))))
69
70(define hwp-service-type
71 (service-type (name 'hwp)
72 (extensions
73 (list (service-extension activation-service-type
74 hwp-activation)))
75 (description
76 "hipis-web-page: Automatically build guile haunt pages.")))