web-files/default.nix

30 lines
1.0 KiB
Nix

{ stdenv, mkYarnModules, bergamot-elm }:
let
# Generate a Nix expression from the yarn.lock file
yarnModules = mkYarnModules {
version = "1.0.0";
pname = "web-files";
packageJSON = ./package.json;
yarnLock = ./yarn.lock;
};
in
stdenv.mkDerivation {
name = "web-files";
src = ./.;
# Use the generated yarnModules
buildInputs = [ yarnModules bergamot-elm ];
installPhase = ''
mkdir -p $out $out/katex $out/vis-network $out/normalize $out/katex-expression $out/bergamot
cp ${yarnModules}/node_modules/katex/dist/katex.min.css $out/katex
cp ${yarnModules}/node_modules/vis-network/dist/vis-network.min.js $out/vis-network
cp ${yarnModules}/node_modules/normalize.css/normalize.css $out/normalize/normalize.css
cp -r ${yarnModules}/node_modules/katex/dist/fonts $out/katex
cp ${yarnModules}/node_modules/@navsnpm/katex-expression/dist/katex-expression/* $out/katex-expression
cp ${bergamot-elm}/Main.min.js $out/bergamot/bergamot.js
'';
}