about summary refs log tree commit diff
path: root/nix/pkgs/gemma.nix
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@gmail.com>2018-01-03T22·02+0100
committerVincent Ambo <tazjin@gmail.com>2018-01-03T22·02+0100
commita6a48806c4a870965d83cd936a323fea9ff19c54 (patch)
tree9925e6044c6185e6eea9b3e94f88cb31e96ce623 /nix/pkgs/gemma.nix
parent9464a1dee43740054a1cb01e00930906e75758b8 (diff)
feat(nix): Add Gemma example deployment
Diffstat (limited to 'nix/pkgs/gemma.nix')
-rw-r--r--nix/pkgs/gemma.nix54
1 files changed, 54 insertions, 0 deletions
diff --git a/nix/pkgs/gemma.nix b/nix/pkgs/gemma.nix
new file mode 100644
index 000000000000..4e96734794ff
--- /dev/null
+++ b/nix/pkgs/gemma.nix
@@ -0,0 +1,54 @@
+{ pkgs ? import <nixpkgs> {} }:
+
+with pkgs; stdenv.mkDerivation rec {
+  name = "gemma";
+
+  src = fetchFromGitHub {
+    owner  = "tazjin";
+    repo   = "gemma";
+    rev    = "61be253d6baa99f0a2208425b8a03b444bb1b184";
+    sha256 = "0vbmz2aphcida728rc0z3k7gychs4w1778vsjbrs0ljk9qgbmyr5";
+  };
+
+  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;
+  };
+}