tvl-depot/fun/gemma/default.nix
Vincent Ambo b59f712535 fix(gemma): Fix build by backporting Elm 0.18
Backports an old version of the Elm language (before the release where
they made everyone rewrite their programs), from the same old nixpkgs
commit as was previously used in overrides (see CL/2646).

Change-Id: I0ae4cc611aa40269b290651ab982c1db93518d8a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2649
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-03-24 00:54:43 +00:00

50 lines
1.3 KiB
Nix

{ depot, pkgs, ... }:
let
inherit (pkgs) cacert iana-etc libredirect stdenv runCommandNoCC writeText;
elmPackages = pkgs.elmPackages_0_18;
frontend = stdenv.mkDerivation {
name = "gemma-frontend.html";
src = ./frontend;
buildInputs = [ cacert iana-etc elmPackages.elm ];
# The individual Elm packages this requires are not packaged and I
# can't be bothered to do that now, so lets open the escape hatch:
outputHashAlgo = "sha256";
outputHash = "000xhds5bsig3kbi7dhgbv9h7myacf34bqvw7avvz7m5mwnqlqg7";
phases = [ "unpackPhase" "buildPhase" ];
buildPhase = ''
export NIX_REDIRECTS=/etc/protocols=${iana-etc}/etc/protocols \
LD_PRELOAD=${libredirect}/lib/libredirect.so
export SYSTEM_CERTIFICATE_PATH=${cacert}/etc/ssl/certs
mkdir .home && export HOME="$PWD/.home"
elm-make --yes Main.elm --output $out
'';
};
injectFrontend = writeText "gemma-frontend.lisp" ''
(in-package :gemma)
(setq *static-file-location* "${runCommandNoCC "frontend" {} ''
mkdir -p $out
cp ${frontend} $out/index.html
''}/")
'';
in depot.nix.buildLisp.program {
name = "gemma";
deps = with pkgs.lisp; [
cl-json
cl-prevalence
hunchentoot
local-time
];
srcs = [
./src/gemma.lisp
injectFrontend
];
}