about summary refs log tree commit diff
path: root/services/gemma/default.nix
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2019-06-29T13·13+0100
committerVincent Ambo <tazjin@google.com>2019-06-29T13·13+0100
commit60532a541b4a1e2c19bb9de95f1ffd72d1579067 (patch)
treeb8cbdf87bc5cf8d3e27835f034aa14d7c44a286f /services/gemma/default.nix
parent61be253d6baa99f0a2208425b8a03b444bb1b184 (diff)
refactor(gemma): Move Gemma source into monorepo stucture
Diffstat (limited to 'services/gemma/default.nix')
-rw-r--r--services/gemma/default.nix49
1 files changed, 49 insertions, 0 deletions
diff --git a/services/gemma/default.nix b/services/gemma/default.nix
new file mode 100644
index 000000000000..02f8c225f9e8
--- /dev/null
+++ b/services/gemma/default.nix
@@ -0,0 +1,49 @@
+with import <nixpkgs> {};
+
+stdenv.mkDerivation rec {
+  name = "gemma";
+
+  src = ./.;
+
+  buildInputs = with lispPackages; [
+    sbcl
+    quicklisp
+    hunchentoot
+    cl-json
+    local-time
+    elmPackages.elm
+    pkgconfig
+  ];
+
+  # The build phase has three distinct things it needs to do:
+  #
+  # 1. "Compile" the Elm source into something useful to browsers.
+  #
+  # 2. Configure the Lisp part of the application to serve the compiled Elm
+  #
+  # 3. Build (and don't strip!) an executable out of the Lisp backend.
+  buildPhase = ''
+    mkdir -p $out/share/gemma $out/bin
+    mkdir .home && export HOME="$PWD/.home"
+
+    # Build Elm
+    cd frontend
+    elm-make --yes Main.elm --output $out/share/gemma/index.html
+
+    # Build Lisp
+    cd $src
+    quicklisp init
+    env GEMMA_BIN_TARGET=$out/bin/gemma sbcl --load build.lisp
+  '';
+
+  installPhase = "true";
+
+  # Stripping an SBCL executable removes the application, which is unfortunate.
+  dontStrip = true;
+
+  meta = with stdenv.lib; {
+    description = "Tool for tracking recurring tasks";
+    homepage    = "https://github.com/tazjin/gemma";
+    license     = licenses.gpl3;
+  };
+}