Add building and linking Agda as build step

Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
This commit is contained in:
Danila Fedorin 2024-05-23 07:37:52 +00:00
parent abba267fec
commit ee116b138f
4 changed files with 57 additions and 7 deletions

View File

@ -25,6 +25,12 @@ cp -r $webFiles/* static/
# Build site with Hugo
hugo $hugoFlags --config=config.toml,config-urls.toml
# Run Agda to generate HTML files for all Agda projects
# Agda will write interface files, so make .code/ writable
chmod -R u+w code
agdaCommand="agda -l standard-library -i . "
ruby ./build-agda-html.rb "$agdaCommand"
# Create generated files
# Can't do submodules because nix flake inputs get their .git deleted
mkdir -p static/graph && ruby ./analyze.rb > static/graph/graph.gen.js # Graph files
@ -39,4 +45,6 @@ mkdir $out
cp -r public/$publicPath/* $out/
# Render math in HTML and XML files.
find $out/ -regex "$out/.*\.html" | xargs katex-html
htmlfiles=$(find $out/ -regex "$out/.*\.html")
echo $htmlfiles | xargs katex-html
echo $htmlfiles | xargs ${gems}/bin/bundle exec ${ruby}/bin/ruby ./agda.rb

View File

@ -23,11 +23,11 @@
"blog-source": {
"flake": false,
"locked": {
"lastModified": 1716424472,
"narHash": "sha256-qutuqf3NvqnRGj7A0fbeQBUzapRithWBpsZPr9oNC00=",
"lastModified": 1716449496,
"narHash": "sha256-8Mt9X3rg17QNljfy7qwqPal/DooqTBx7R+UNm10xRb8=",
"ref": "refs/heads/master",
"rev": "54844fb954d6ef5b397db4c4b2b9f07bce56d73d",
"revCount": 766,
"rev": "c027efa931b7a248b138467f4c7415d27f02a654",
"revCount": 775,
"submodules": true,
"type": "git",
"url": "https://dev.danilafe.com/Web-Projects/blog-static.git"

33
gemset.nix Normal file
View File

@ -0,0 +1,33 @@
{
mini_portile2 = {
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "149r94xi6b3jbp6bv72f8383b95ndn0p5sxnq11gs1j9jadv0ajf";
type = "gem";
};
version = "2.8.6";
};
nokogiri = {
dependencies = ["mini_portile2" "racc"];
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "023f2j0q8makgmmfj4pv2fhwgcbh9y8s678za1cb68ry9fdpkkkh";
type = "gem";
};
version = "1.15.6";
};
racc = {
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "021s7maw0c4d9a6s07vbmllrzqsj2sgmrwimlh8ffkvwqdjrld09";
type = "gem";
};
version = "1.8.0";
};
}

13
lib.nix
View File

@ -5,9 +5,18 @@ with lib;
let
protocol = ssl: if ssl then "https://" else "http://";
gems = bundlerEnv {
inherit ruby;
name = "blog-static-flake";
gemfile = "${blog-source}/Gemfile";
lockfile = "${blog-source}/Gemfile.lock";
gemset = ./gemset.nix;
};
website = settings: stdenv.mkDerivation {
inherit (settings) src ssl host;
inherit resume;
inherit resume gems ruby;
name = "blog-static";
version = settings.src.rev or "dirty";
publicPath = settings.path;
@ -18,7 +27,7 @@ let
builder = ./build/builder.sh;
webFiles = web-files;
buildInputs = [
hugo ruby stork katex-html
hugo ruby stork katex-html (agda.withPackages [ agdaPackages.standard-library ])
];
};
in