aboutsummaryrefslogtreecommitdiff
path: root/pkgs
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/InputXSLT.nix20
-rw-r--r--pkgs/KaTeX.nix50
2 files changed, 70 insertions, 0 deletions
diff --git a/pkgs/InputXSLT.nix b/pkgs/InputXSLT.nix
new file mode 100644
index 0000000..a85bc37
--- /dev/null
+++ b/pkgs/InputXSLT.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchFromGitHub, cmake, boost, xalanc, xercesc, discount }:
+
+stdenv.mkDerivation rec {
+ name = "InputXSLT";
+
+ src = fetchFromGitHub {
+ owner = "KnairdA";
+ repo = "InputXSLT";
+ rev = "master";
+ sha256 = "1j9fld3sh1jyscnsx6ab9jn5x6q67rjh9p3bgsh5na1qrs40dql0";
+ };
+
+ buildInputs = [ cmake boost xalanc xercesc discount ];
+
+ meta = with stdenv.lib; {
+ description = "InputXSLT";
+ homepage = https://github.com/KnairdA/InputXSLT/;
+ license = stdenv.lib.licenses.asl20;
+ };
+}
diff --git a/pkgs/KaTeX.nix b/pkgs/KaTeX.nix
new file mode 100644
index 0000000..6565b13
--- /dev/null
+++ b/pkgs/KaTeX.nix
@@ -0,0 +1,50 @@
+{ stdenv, pkgs, ... }:
+
+let
+ katex-src = stdenv.mkDerivation rec {
+ name = "katex-src";
+
+ src = pkgs.fetchzip {
+ url = "https://github.com/Khan/KaTeX/releases/download/v0.10.0-alpha/katex.zip";
+ sha256 = "002dzyf3wcyjxv4m6vv0v99gf82a9k7rxsnlvf93h9fhcda2vj7l";
+ };
+
+ buildInputs = [ pkgs.nodejs ];
+
+ installPhase = ''
+ mkdir -p $out/share/katex
+
+ cp katex.min.js $out/share/katex/
+ '';
+
+ meta = {
+ description = "KaTeX";
+ homepage = https://github.com/Khan/KaTeX;
+ license = stdenv.lib.licenses.mit;
+ platforms = stdenv.lib.platforms.all;
+ };
+ };
+in pkgs.writeTextFile {
+ name = "katex-wrapper";
+ executable = true;
+ destination = "/bin/katex";
+
+ text = ''
+ #!${pkgs.nodejs}/bin/node
+
+ var katex = require("${katex-src}/share/katex/katex.min.js");
+ var input = "";
+
+ var args = process.argv.slice(2);
+
+ process.stdin.on("data", function(chunk) {
+ input += chunk.toString();
+ });
+
+ process.stdin.on("end", function() {
+ var options = { displayMode: args.indexOf("--display-mode") !== -1 };
+ var output = katex.renderToString(input, options);
+ console.log(output);
+ });
+ '';
+}