tvl-depot/fun/gemma/default.nix
sterni 16db185d97 chore(3p/sources): Bump channels & overlays
* //third_party/overlays/tvl: remove SBCL override, as SBCL 2.2.11 fixes
  the bug we were running into.

* //fun/gemma: use historical nixpkgs for everything due to ABI
  incompatibilities triggered by preloaded libredirect.so wanting
  GLIBC_2.34 which is not available in elm-make.

Change-Id: I465f0366413856e45ddd1e67fc9d732075e2f3c5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7595
Tested-by: BuildkiteCI
Autosubmit: sterni <sternenseemann@systemli.org>
Reviewed-by: grfn <grfn@gws.fyi>
2022-12-24 12:42:41 +00:00

56 lines
1.3 KiB
Nix

{ depot, ... }:
let
inherit (depot.third_party.elmPackages_0_18) cacert iana-etc libredirect stdenv runCommand writeText elmPackages;
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* "${runCommand "frontend" {} ''
mkdir -p $out
cp ${frontend} $out/index.html
''}/")
'';
in
depot.nix.buildLisp.program {
name = "gemma";
deps = with depot.third_party.lisp; [
cl-json
cl-prevalence
hunchentoot
local-time
];
srcs = [
./src/gemma.lisp
injectFrontend
];
# depends on SBCL
brokenOn = [
"ccl"
"ecl"
];
}