about summary refs log tree commit diff
path: root/default.nix
blob: 43950571c51d98bc7c01a9e5019ad5e2d69a26ee (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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
    sbcl --load build.lisp

    # "Install" result
    cp $src/gemma $out/bin/gemma
  '';

  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;
  };
}