diff options
Diffstat (limited to 'blog')
-rw-r--r-- | blog/default.nix | 28 | ||||
-rw-r--r-- | blog/posts/test.md | 4 | ||||
-rw-r--r-- | blog/src/index.html | 16 | ||||
-rw-r--r-- | blog/src/server.lisp | 49 |
4 files changed, 0 insertions, 97 deletions
diff --git a/blog/default.nix b/blog/default.nix deleted file mode 100644 index 5359a0ab6f37..000000000000 --- a/blog/default.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ - nixpkgs ? import <nixpkgs> {}, - depot ? import <depot> {}, - universe ? import <universe> {}, - ... -}: - -let - injectedPosts = nixpkgs.writeText "posts.lisp" '' - (in-package #:server) - (setq *path-to-posts* "${./posts}") - ''; - injectedExecutables = nixpkgs.writeText "executables.lisp" '' - (in-package #:server) - (setq *pandoc-bin* "${nixpkgs.pandoc}/bin/pandoc") - ''; -in depot.nix.buildLisp.program { - name = "server"; - deps = with depot.third_party.lisp; with universe.third_party.lisp; [ - hunchentoot - cl-arrows - ]; - srcs = [ - ./src/server.lisp - injectedPosts - injectedExecutables - ]; -} diff --git a/blog/posts/test.md b/blog/posts/test.md deleted file mode 100644 index ec2e030b2824..000000000000 --- a/blog/posts/test.md +++ /dev/null @@ -1,4 +0,0 @@ -# Testing - -The goal here is to be able to write markdown files and have a server that can -render the markdown into HTML and serve them to the clients. diff --git a/blog/src/index.html b/blog/src/index.html deleted file mode 100644 index a9d9cf7eaa25..000000000000 --- a/blog/src/index.html +++ /dev/null @@ -1,16 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> - <head> - <meta charset="utf-8" /> - <meta name="viewport" content="width=device-width, initial-scale=1" /> - <meta name="description" content="Showcase of AI bots at DeepMind" /> - <link rel="stylesheet" href="/index.css"> - <title>AI Showcase</title> - <script data-ad-client="ca-pub-6018268443649487" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> - </head> - <body> - <noscript>You need to enable JavaScript to run this app.</noscript> - <h1>Welcome</h1> - <p>To my blog!</p> - </body> -</html> diff --git a/blog/src/server.lisp b/blog/src/server.lisp deleted file mode 100644 index ad8169fa1af9..000000000000 --- a/blog/src/server.lisp +++ /dev/null @@ -1,49 +0,0 @@ -(in-package #:cl-user) -(defpackage #:server - (:documentation "Robot condemned to a life of admin work for my blog.") - (:use #:cl) - (:import-from #:cl-arrows #:->>) - (:export :main)) -(in-package #:server) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Nix-injected dependencies -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;; TODO: Wrap this in an assert or ensure that there's a trailing slash so it's -;; treated as a directory. -(defvar *path-to-posts* "/tmp/" - "File path pointing to the posts directory.") - -(defvar *pandoc-bin* "/usr/bin/pandoc") - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Library -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -(defun render-post (path) - "Render the markdown file stored at PATH to HTML using pandoc." - (uiop:run-program (list *pandoc-bin* path "--to" "html") - :output :string)) - -;; TODO: Figure out how to handle this with Nix. -(defvar *posts* (uiop:directory-files *path-to-posts*) - "List of the paths to the blog posts.") - -(hunchentoot:define-easy-handler - (get-latest :uri "/latest") () - (render-post (concatenate 'string *path-to-posts* "/" "test.md"))) - -(hunchentoot:define-easy-handler - (get-posts :uri "/posts") () - "Working!") - -(defun main () - "This is the main entrypoint for our application." - (hunchentoot:start (make-instance 'hunchentoot:easy-acceptor :port 4242)) - (print "Listing on port 4242...") - (sb-thread:join-thread - (find-if (lambda (th) - (string= (sb-thread:thread-name th) - "hunchentoot-listener-*:4242")) - (sb-thread:list-all-threads)))) |