2021-03-24 00:59:29 +01:00
|
|
|
{ depot, pkgs, ... }:
|
2017-12-29 16:42:10 +01:00
|
|
|
|
2019-11-15 16:26:08 +01:00
|
|
|
let
|
2021-03-24 00:59:29 +01:00
|
|
|
inherit (pkgs) cacert iana-etc libredirect stdenv runCommandNoCC writeText;
|
2021-04-10 13:38:50 +02:00
|
|
|
elmPackages = depot.third_party.elmPackages_0_18;
|
2019-09-02 03:14:39 +02:00
|
|
|
|
2019-11-15 16:26:08 +01:00
|
|
|
frontend = stdenv.mkDerivation {
|
2020-01-22 02:27:21 +01:00
|
|
|
name = "gemma-frontend.html";
|
2019-11-15 16:26:08 +01:00
|
|
|
src = ./frontend;
|
2021-03-24 00:59:29 +01:00
|
|
|
buildInputs = [ cacert iana-etc elmPackages.elm ];
|
2020-01-22 02:27:21 +01:00
|
|
|
|
|
|
|
# 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";
|
2019-11-15 16:26:08 +01:00
|
|
|
|
|
|
|
phases = [ "unpackPhase" "buildPhase" ];
|
|
|
|
buildPhase = ''
|
2020-01-22 02:27:21 +01:00
|
|
|
export NIX_REDIRECTS=/etc/protocols=${iana-etc}/etc/protocols \
|
|
|
|
LD_PRELOAD=${libredirect}/lib/libredirect.so
|
|
|
|
|
|
|
|
export SYSTEM_CERTIFICATE_PATH=${cacert}/etc/ssl/certs
|
|
|
|
|
2019-11-15 16:26:08 +01:00
|
|
|
mkdir .home && export HOME="$PWD/.home"
|
2020-01-22 02:27:21 +01:00
|
|
|
elm-make --yes Main.elm --output $out
|
2019-11-15 16:26:08 +01:00
|
|
|
'';
|
|
|
|
};
|
2020-01-22 02:27:21 +01:00
|
|
|
|
2020-02-21 13:47:29 +01:00
|
|
|
injectFrontend = writeText "gemma-frontend.lisp" ''
|
2020-01-22 02:27:21 +01:00
|
|
|
(in-package :gemma)
|
|
|
|
(setq *static-file-location* "${runCommandNoCC "frontend" {} ''
|
|
|
|
mkdir -p $out
|
|
|
|
cp ${frontend} $out/index.html
|
2020-01-22 12:56:33 +01:00
|
|
|
''}/")
|
2020-01-22 02:27:21 +01:00
|
|
|
'';
|
2020-02-21 13:47:29 +01:00
|
|
|
in
|
|
|
|
depot.nix.buildLisp.program {
|
2017-12-29 16:42:10 +01:00
|
|
|
name = "gemma";
|
|
|
|
|
2021-04-10 13:38:50 +02:00
|
|
|
deps = with depot.third_party.lisp; [
|
2017-12-29 16:42:10 +01:00
|
|
|
cl-json
|
2019-09-02 03:14:39 +02:00
|
|
|
cl-prevalence
|
2020-01-22 02:27:21 +01:00
|
|
|
hunchentoot
|
2017-12-29 16:42:10 +01:00
|
|
|
local-time
|
|
|
|
];
|
|
|
|
|
2020-01-22 02:27:21 +01:00
|
|
|
srcs = [
|
|
|
|
./src/gemma.lisp
|
|
|
|
injectFrontend
|
|
|
|
];
|
2021-08-09 02:47:07 +02:00
|
|
|
|
|
|
|
# depends on SBCL
|
|
|
|
brokenOn = [
|
2021-08-13 22:24:50 +02:00
|
|
|
"ccl"
|
2021-08-09 02:47:07 +02:00
|
|
|
"ecl"
|
|
|
|
];
|
2021-03-24 00:59:29 +01:00
|
|
|
}
|