A Ruby script to convert LaTeX in pages into HTML.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

31 lines
765 B

{ bundlerEnv, ruby, stdenv, katex-server }:
let
gems = bundlerEnv {
inherit ruby;
name = "render-test";
gemfile = ./Gemfile;
lockfile = ./Gemfile.lock;
gemset = ./gemset.nix;
};
in
stdenv.mkDerivation {
name = "katex-html";
src = ./convert.rb;
buildInputs = [ katex-server gems ruby ];
unpackPhase = "echo 'Skipping unpack phase (nothing to unpack)'";
installPhase = ''
mkdir -p $out/{bin,share/katex-html}
cp $src $out/share/katex-html/convert.rb
cat > $out/bin/katex-html <<EOF
#!/bin/sh -e
${katex-server}/bin/katex-server &
server_pid=\$!
sleep 1
${gems}/bin/bundle exec ${ruby}/bin/ruby $out/share/katex-html/convert.rb \$@
kill -KILL \$server_pid
EOF
chmod +x $out/bin/katex-html
'';
}