diff --git a/.gitignore b/.gitignore
index 6b847442..637468b7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,4 @@
/requirements/export
/target
result
+whitepaper/main.pdf
diff --git a/flake.lock b/flake.lock
index 671bc799..21b3ce75 100644
--- a/flake.lock
+++ b/flake.lock
@@ -2,15 +2,14 @@
"nodes": {
"devshell": {
"inputs": {
- "flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
},
"locked": {
- "lastModified": 1705332421,
- "narHash": "sha256-USpGLPme1IuqG78JNqSaRabilwkCyHmVWY0M9vYyqEA=",
+ "lastModified": 1728330715,
+ "narHash": "sha256-xRJ2nPOXb//u1jaBnDP56M7v5ldavjbtR6lfGqSvcKg=",
"owner": "numtide",
"repo": "devshell",
- "rev": "83cb93d6d063ad290beee669f4badf9914cc16ec",
+ "rev": "dd6b80932022cea34a019e2bb32f6fa9e494dfef",
"type": "github"
},
"original": {
@@ -27,11 +26,11 @@
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
- "lastModified": 1706682087,
- "narHash": "sha256-9AQQhjTRcVlqwOxM8im6wR+vDT1N0efUX7pvAyfAzLE=",
+ "lastModified": 1731479620,
+ "narHash": "sha256-jBYFboMLYs0LcIfZq+kprR4vOjz6cfqaS8trwogoXQE=",
"ref": "main",
- "rev": "7e29c0af8b70147f1f23c1387a0d774209889d1b",
- "revCount": 1761,
+ "rev": "46c04695cd28be15ff88e3b8d2716818b034c084",
+ "revCount": 2076,
"type": "git",
"url": "https://github.com/nix-community/fenix.git"
},
@@ -41,24 +40,6 @@
"url": "https://github.com/nix-community/fenix.git"
}
},
- "flake-utils": {
- "inputs": {
- "systems": "systems"
- },
- "locked": {
- "lastModified": 1701680307,
- "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
- "owner": "numtide",
- "repo": "flake-utils",
- "rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
- "type": "github"
- },
- "original": {
- "owner": "numtide",
- "repo": "flake-utils",
- "type": "github"
- }
- },
"naersk": {
"inputs": {
"nixpkgs": [
@@ -66,11 +47,11 @@
]
},
"locked": {
- "lastModified": 1698420672,
- "narHash": "sha256-/TdeHMPRjjdJub7p7+w55vyABrsJlt5QkznPYy55vKA=",
+ "lastModified": 1721727458,
+ "narHash": "sha256-r/xppY958gmZ4oTfLiHN0ZGuQ+RSTijDblVgVLFi1mw=",
"ref": "refs/heads/master",
- "rev": "aeb58d5e8faead8980a807c840232697982d47b9",
- "revCount": 333,
+ "rev": "3fb418eaf352498f6b6c30592e3beb63df42ef11",
+ "revCount": 345,
"type": "git",
"url": "https://github.com/nix-community/naersk.git"
},
@@ -81,11 +62,11 @@
},
"nixpkgs": {
"locked": {
- "lastModified": 1704161960,
- "narHash": "sha256-QGua89Pmq+FBAro8NriTuoO/wNaUtugt29/qqA8zeeM=",
+ "lastModified": 1722073938,
+ "narHash": "sha256-OpX0StkL8vpXyWOGUD6G+MA26wAXK6SpT94kLJXo6B4=",
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "63143ac2c9186be6d9da6035fa22620018c85932",
+ "rev": "e36e9f57337d0ff0cf77aceb58af4c805472bfae",
"type": "github"
},
"original": {
@@ -95,13 +76,13 @@
"type": "github"
}
},
- "nixpkgs_2": {
+ "nixpkgs-unstable": {
"locked": {
- "lastModified": 1719848872,
- "narHash": "sha256-H3+EC5cYuq+gQW8y0lSrrDZfH71LB4DAf+TDFyvwCNA=",
+ "lastModified": 1731139594,
+ "narHash": "sha256-IigrKK3vYRpUu+HEjPL/phrfh7Ox881er1UEsZvw9Q4=",
"owner": "nixos",
"repo": "nixpkgs",
- "rev": "00d80d13810dbfea8ab4ed1009b09100cca86ba8",
+ "rev": "76612b17c0ce71689921ca12d9ffdc9c23ce40b2",
"type": "github"
},
"original": {
@@ -111,24 +92,43 @@
"type": "github"
}
},
+ "nixpkgs_2": {
+ "locked": {
+ "lastModified": 1731239293,
+ "narHash": "sha256-q2yjIWFFcTzp5REWQUOU9L6kHdCDmFDpqeix86SOvDc=",
+ "owner": "nixos",
+ "repo": "nixpkgs",
+ "rev": "9256f7c71a195ebe7a218043d9f93390d49e6884",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nixos",
+ "ref": "nixos-24.05",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
"root": {
"inputs": {
"devshell": "devshell",
"fenix": "fenix",
"naersk": "naersk",
"nixpkgs": "nixpkgs_2",
+ "nixpkgs-unstable": "nixpkgs-unstable",
"treefmt-nix": "treefmt-nix",
+ "typix": "typix",
+ "typst-packages": "typst-packages",
"utils": "utils"
}
},
"rust-analyzer-src": {
"flake": false,
"locked": {
- "lastModified": 1706641601,
- "narHash": "sha256-/4U323L9F6wlBGvGBoE3+D6Af+dLJA+mq0QXbuNxohc=",
+ "lastModified": 1731342671,
+ "narHash": "sha256-36eYDHoPzjavnpmEpc2MXdzMk557S0YooGms07mDuKk=",
"owner": "rust-lang",
"repo": "rust-analyzer",
- "rev": "9a832c47e85e94496e10e1e81636d3d89afeb0d4",
+ "rev": "fc98e0657abf3ce07eed513e38274c89bbb2f8ad",
"type": "github"
},
"original": {
@@ -153,51 +153,72 @@
"type": "github"
}
},
- "systems_2": {
+ "treefmt-nix": {
+ "inputs": {
+ "nixpkgs": [
+ "nixpkgs"
+ ]
+ },
"locked": {
- "lastModified": 1681028828,
- "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
- "owner": "nix-systems",
- "repo": "default",
- "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+ "lastModified": 1730321837,
+ "narHash": "sha256-vK+a09qq19QNu2MlLcvN4qcRctJbqWkX7ahgPZ/+maI=",
+ "owner": "numtide",
+ "repo": "treefmt-nix",
+ "rev": "746901bb8dba96d154b66492a29f5db0693dbfcc",
"type": "github"
},
"original": {
- "owner": "nix-systems",
- "repo": "default",
+ "owner": "numtide",
+ "repo": "treefmt-nix",
"type": "github"
}
},
- "treefmt-nix": {
+ "typix": {
"inputs": {
"nixpkgs": [
- "nixpkgs"
+ "nixpkgs-unstable"
]
},
"locked": {
- "lastModified": 1719243788,
- "narHash": "sha256-9T9mSY35EZSM1KAwb7K9zwQ78qTlLjosZgtUGnw4rn4=",
- "owner": "numtide",
- "repo": "treefmt-nix",
- "rev": "065a23edceff48f948816b795ea8cc6c0dee7cdf",
+ "lastModified": 1731352170,
+ "narHash": "sha256-2JOC9lrFa0NfP9kfaT3dnm8WG5yAeDPONHJeMYl+O60=",
+ "owner": "loqusion",
+ "repo": "typix",
+ "rev": "7365cb7e6665350cb7b013abba1cbb70fcf07c53",
"type": "github"
},
"original": {
- "owner": "numtide",
- "repo": "treefmt-nix",
+ "owner": "loqusion",
+ "repo": "typix",
+ "type": "github"
+ }
+ },
+ "typst-packages": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1731485222,
+ "narHash": "sha256-uhXDznbGLS4s6d2S8OHUCzpgmJQ1H2HCJug7kRIY0Jw=",
+ "owner": "typst",
+ "repo": "packages",
+ "rev": "4979ee3923fb0143e5d076854cb0d94bbf367a2c",
+ "type": "github"
+ },
+ "original": {
+ "owner": "typst",
+ "repo": "packages",
"type": "github"
}
},
"utils": {
"inputs": {
- "systems": "systems_2"
+ "systems": "systems"
},
"locked": {
- "lastModified": 1705309234,
- "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
+ "lastModified": 1726560853,
+ "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
"ref": "refs/heads/main",
- "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
- "revCount": 90,
+ "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
+ "revCount": 101,
"type": "git",
"url": "https://github.com/numtide/flake-utils.git"
},
diff --git a/flake.nix b/flake.nix
index b25d2c54..d95c7100 100644
--- a/flake.nix
+++ b/flake.nix
@@ -2,7 +2,16 @@
description = "a minimal WASM interpreter";
inputs = {
- nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
+ nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
+ nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
+ typst-packages = {
+ url = "github:typst/packages";
+ flake = false;
+ };
+ typix = {
+ url = "github:loqusion/typix";
+ inputs.nixpkgs.follows = "nixpkgs-unstable";
+ };
utils.url = "git+https://github.com/numtide/flake-utils.git";
devshell.url = "github:numtide/devshell";
fenix = {
@@ -24,28 +33,34 @@
lib = nixpkgs.lib;
pkgs = import nixpkgs {
inherit system;
- overlays = [ devshell.overlays.default ];
+ overlays = [
+ devshell.overlays.default
+
+ # We unfortunately need the most up-to-date typst
+ (final: prev: {
+ typst = inputs.nixpkgs-unstable.legacyPackages.${pkgs.hostPlatform.system}.typst;
+ })
+ ];
};
# universal formatter
treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
# rust target name of the `system`
- rust-target = pkgs.rust.toRustTarget pkgs.pkgsStatic.targetPlatform;
+ rust-target = pkgs.pkgsStatic.targetPlatform.rust.rustcTarget;
# Rust distribution for our hostSystem
fenix = inputs.fenix.packages.${system};
- rust-toolchain = with fenix;
- combine [
- latest.rustc
- latest.cargo
- latest.clippy
- latest.rustfmt
- targets.${rust-target}.latest.rust-std
- targets.thumbv6m-none-eabi.latest.rust-std # for no_std test
- targets.wasm32-unknown-unknown.latest.rust-std
- ];
+ rust-toolchain = with fenix; combine [
+ latest.rustc
+ latest.cargo
+ latest.clippy
+ latest.rustfmt
+ targets.${rust-target}.latest.rust-std
+ targets.thumbv6m-none-eabi.latest.rust-std # for no_std test
+ targets.wasm32-unknown-unknown.latest.rust-std
+ ];
# overrides a naersk-lib which uses the stable toolchain expressed above
naersk-lib = (naersk.lib.${system}.override {
@@ -53,14 +68,31 @@
rustc = rust-toolchain;
});
+ typstPackagesCache = pkgs.stdenv.mkDerivation {
+ name = "typst-packages-cache";
+ src = inputs.typst-packages;
+ dontBuild = true;
+ installPhase = ''
+ mkdir -p "$out/typst/packages"
+ cp --dereference --no-preserve=mode --recursive --reflink=auto \
+ --target-directory="$out/typst/packages" -- "$src"/packages/*
+ '';
+ };
in
{
# packages
packages.wasm-interpreter = pkgs.callPackage pkgs/wasm-interpreter.nix { };
+ packages.whitepaper = inputs.typix.lib.${system}.buildTypstProject {
+ name = "whitepaper.pdf";
+ src = ./whitepaper;
+ XDG_CACHE_HOME = typstPackagesCache;
+ };
+
packages.report = pkgs.callPackage pkgs/report.nix {
- inherit (self.packages.${system}) wasm-interpreter;
+ inherit (self.packages.${system}) wasm-interpreter whitepaper;
};
+
# a devshell with all the necessary bells and whistles
devShells.default = (pkgs.devshell.mkShell {
imports = [ "${devshell}/extra/git/hooks.nix" ];
@@ -84,6 +116,7 @@
nixpkgs-fmt
nodePackages.prettier
treefmtEval.config.build.wrapper
+ typst # for the whitepaper
];
env = [
{
@@ -132,6 +165,13 @@
'';
help = "start cargo watch loop for documentation";
}
+ {
+ name = "whitepaper-watch";
+ command = ''
+ typst watch --root "$PRJ_ROOT/whitepaper" "$PRJ_ROOT/whitepaper/main.typ"
+ '';
+ help = "start typst watch loop for the whitepaper";
+ }
];
});
diff --git a/pkgs/report.nix b/pkgs/report.nix
index 0bf701bf..3efff931 100644
--- a/pkgs/report.nix
+++ b/pkgs/report.nix
@@ -1,4 +1,4 @@
-{ lib, stdenvNoCC, python3Packages, strictdoc, wasm-interpreter }:
+{ lib, stdenvNoCC, python3Packages, strictdoc, wasm-interpreter, whitepaper }:
let
evidenceRoot = lib.strings.escapeShellArg wasm-interpreter;
@@ -22,6 +22,7 @@ stdenvNoCC.mkDerivation {
cp --recursive -- ${evidenceRoot}/bench-html bench
cp --recursive -- ${evidenceRoot}/lcov-html coverage
cp --recursive -- ${evidenceRoot}/share/doc/ rustdoc
+ cp --dereference -- ${whitepaper} whitepaper.pdf
mkdir test
junit2html ${evidenceRoot}/junit.xml test/index.html
diff --git a/pkgs/report_index.html b/pkgs/report_index.html
index 5dd9d289..d8be26f0 100644
--- a/pkgs/report_index.html
+++ b/pkgs/report_index.html
@@ -47,5 +47,6 @@
Tests
Coverage
Benchmark
+ Whitepaper