From 78db43898b2d1134a063e57300ee470cd1b8d1be Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 22 Jan 2020 01:27:21 +0000 Subject: refactor(fun/gemma): Use buildLisp.nix to build Gemma 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. --- fun/gemma/src/gemma.lisp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'fun/gemma/src/gemma.lisp') diff --git a/fun/gemma/src/gemma.lisp b/fun/gemma/src/gemma.lisp index b8a20addd9..cf074cfb87 100644 --- a/fun/gemma/src/gemma.lisp +++ b/fun/gemma/src/gemma.lisp @@ -1,4 +1,4 @@ -;; Copyright (C) 2016-2017 Vincent Ambo +;; Copyright (C) 2016-2020 Vincent Ambo ;; ;; 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." -- cgit 1.4.1