init
This commit is contained in:
commit
f15932fc62
10 changed files with 303 additions and 0 deletions
51
package.nix
Normal file
51
package.nix
Normal file
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
esbuild,
|
||||
elmPackages,
|
||||
stdenv,
|
||||
http-server,
|
||||
...
|
||||
}: let
|
||||
elmConfig = elmPackages.fetchElmDeps {
|
||||
elmPackages = import ./src/elm2nix/elm-srcs.nix;
|
||||
elmVersion = "0.19.1";
|
||||
registryDat = ./src/elm2nix/registry.dat;
|
||||
};
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
name = "math-project";
|
||||
src = ./src;
|
||||
nativeBuildInputs = [
|
||||
esbuild
|
||||
elmPackages.elm
|
||||
];
|
||||
buildInputs = [
|
||||
http-server
|
||||
];
|
||||
configurePhase = ''
|
||||
${elmConfig}
|
||||
'';
|
||||
buildPhase = ''
|
||||
elm make ./Main.elm --optimize --output=tmp.js
|
||||
esbuild ./tmp.js --minify --target=es5 --outfile=main.js
|
||||
echo "<!DOCTYPE html><html><head><script type = 'text/javascript' src = './main.js'></script></head><body><script type = 'text/javascript' src = './init.js'></script></body></html>" > index.html
|
||||
'';
|
||||
installPhase = ''
|
||||
mkdir $out/bin -p
|
||||
mkdir $out/src -p
|
||||
|
||||
echo "#!/usr/bin/env bash" > math-project
|
||||
echo "cd $(echo $out)/src/" >> math-project
|
||||
echo "${http-server}/bin/http-server" >> math-project
|
||||
chmod a+x math-project
|
||||
cp math-project $out/bin/math-project
|
||||
|
||||
cp index.html $out/src/index.html
|
||||
cp main.js $out/src/main.js
|
||||
cp init.js $out/src/init.js
|
||||
'';
|
||||
meta = {
|
||||
mainProgram = "math-project";
|
||||
description = "math project";
|
||||
homepage = "https://math.mtgmonkey.net";
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue