diff options
author | Vincent Ambo <tazjin@google.com> | 2020-01-22T01·27+0000 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-01-22T01·27+0000 |
commit | 78db43898b2d1134a063e57300ee470cd1b8d1be (patch) | |
tree | 8df78905ffd566c08f7ea7ca8e498e9fbdae3763 /fun/gemma/src | |
parent | e25916d10c1c81f568f1a413e8b24704e9a81996 (diff) |
refactor(fun/gemma): Use buildLisp.nix to build Gemma r/440
This removes the ASDF system definition for Gemma and switches the code over to buildLisp. The program builds (including some terrifying hacks to get the frontend to work), but there are some bizarre runtime issues that I need to debug.
Diffstat (limited to 'fun/gemma/src')
-rw-r--r-- | fun/gemma/src/gemma.lisp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/fun/gemma/src/gemma.lisp b/fun/gemma/src/gemma.lisp index b8a20addd907..cf074cfb8701 100644 --- a/fun/gemma/src/gemma.lisp +++ b/fun/gemma/src/gemma.lisp @@ -1,4 +1,4 @@ -;; Copyright (C) 2016-2017 Vincent Ambo <mail@tazj.in> +;; Copyright (C) 2016-2020 Vincent Ambo <mail@tazj.in> ;; ;; This file is part of Gemma. ;; @@ -13,7 +13,7 @@ :cl-json) (:import-from :sb-posix :getenv) (:shadowing-import-from :sb-posix :getcwd) - (:export :start-gemma :config :entrypoint)) + (:export :start-gemma :config :main)) (in-package :gemma) ;; TODO: Store an average of how many days it was between task @@ -29,19 +29,16 @@ (defvar *gemma-port* 4242 "Port on which the Gemma web server listens.") -(defvar *static-file-location* - (or (in-case-of (sb-posix:getenv "out") - (concatenate 'string it "/share/gemma/")) - "frontend/") +(defvar *static-file-location* "frontend/" "Folder from which to serve static assets. If built inside of Nix, - the folder is concatenated with the output path at which the files - are expected to be.") + the path is injected during the build.") -(defun initialise-persistence (data-dir) - (defvar *p-tasks* - (cl-prevalence:make-prevalence-system data-dir) +(defvar *p-tasks* nil "All tasks registered in this Gemma instance.") +(defun initialise-persistence (data-dir) + (setq *p-tasks* (cl-prevalence:make-prevalence-system data-dir)) + ;; Initialise database ID counter (or (> (length (cl-prevalence:find-all-objects *p-tasks* 'task)) 0) (cl-prevalence:tx-create-id-counter *p-tasks*))) @@ -161,7 +158,7 @@ maximum interval." (complete-task key) (encode-json-to-string (response-for (get-task key)))))) -(defun entrypoint () +(defun main () "This function serves as the entrypoint for ASDF-built executables. It joins the Hunchentoot server thread to keep the process running for as long as the server is alive." |