about summary refs log tree commit diff
path: root/fun/gemma/default.nix
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2019-12-20T20·18+0000
committerVincent Ambo <tazjin@google.com>2019-12-20T20·18+0000
commit03bfe08e1dd9faf48b06cb146bfa446575cde88a (patch)
tree55317968922a9b2a01516f1b79527874df037517 /fun/gemma/default.nix
parente52eed3cd4f73779c2e7c350537fb346835ba9f3 (diff)
chore: Significantly restructure folder layout r/237
This moves the various projects from "type-based" folders (such as
"services" or "tools") into more appropriate semantic folders (such as
"nix", "ops" or "web").

Deprecated projects (nixcon-demo & gotest) which only existed for
testing/demonstration purposes have been removed.

(Note: *all* builds are broken with this commit)
Diffstat (limited to 'fun/gemma/default.nix')
-rw-r--r--fun/gemma/default.nix61
1 files changed, 61 insertions, 0 deletions
diff --git a/fun/gemma/default.nix b/fun/gemma/default.nix
new file mode 100644
index 000000000000..f48af489217a
--- /dev/null
+++ b/fun/gemma/default.nix
@@ -0,0 +1,61 @@
+{ pkgs, ... }:
+
+let
+  inherit (pkgs) elmPackages lispPackages;
+  inherit (pkgs.third_party) stdenv sbcl makeWrapper openssl;
+
+  frontend = stdenv.mkDerivation {
+    name = "gemma-frontend";
+    src = ./frontend;
+    buildInputs = [ elmPackages.elm ];
+
+    phases = [ "unpackPhase" "buildPhase" ];
+    buildPhase = ''
+      mkdir .home && export HOME="$PWD/.home"
+      mkdir -p $out
+      elm-make --yes Main.elm --output $out/index.html
+    '';
+  };
+in stdenv.mkDerivation rec {
+  name = "gemma";
+  src = ./.;
+
+  nativeBuildInputs = with lispPackages; [
+    sbcl
+    hunchentoot
+    cl-json
+    cffi
+    cl-prevalence
+    local-time
+    makeWrapper
+  ];
+
+  buildPhase = ''
+    mkdir -p $out/share/gemma $out/bin
+
+    # Build Lisp using the Nix-provided wrapper which sets the load
+    # paths correctly.
+    cd $src
+    env GEMMA_BIN_TARGET=$out/bin/gemma common-lisp.sh --load build.lisp
+
+    # Wrap gemma to find OpenSSL at runtime:
+    wrapProgram $out/bin/gemma --prefix LD_LIBRARY_PATH : "${openssl.out}/lib"
+
+    # and finally copy the frontend to the appropriate spot
+    cp ${frontend}/index.html $out/share/gemma/index.html
+  '';
+
+  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;
+
+    # Lisp builds are broken for some reason (2019-09-22)
+    broken = true;
+  };
+}