just mc
This commit is contained in:
parent
607bd60021
commit
07c3004c82
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -7,3 +7,5 @@ yarn-error.log
|
|||
**/.sync.ffs_db
|
||||
.direnv
|
||||
.log
|
||||
result
|
||||
result-bin
|
||||
|
|
31
flake.nix
31
flake.nix
|
@ -21,7 +21,8 @@
|
|||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, gentype, hercules-ci-effects, cargo2nix, flake-utils, ... }:
|
||||
outputs = { self, nixpkgs, gentype, hercules-ci-effects, cargo2nix
|
||||
, flake-utils, ... }:
|
||||
let
|
||||
version = builtins.substring 0 8 self.lastModifiedDate;
|
||||
commonFn = pkgs: {
|
||||
|
@ -30,29 +31,33 @@
|
|||
which = [ pkgs.which ];
|
||||
};
|
||||
gentypeOutputFn = pkgs: gentype.outputs.packages.${pkgs.system}.default;
|
||||
mcCacheFn = { pkgs, ... }:
|
||||
import ./nix/squiggle-mcCache.nix { inherit pkgs; };
|
||||
mcFn = { pkgs, ... }:
|
||||
import ./nix/squiggle-mc.nix { inherit pkgs commonFn; };
|
||||
langFn = { pkgs, ... }:
|
||||
import ./nix/squiggle-lang.nix {
|
||||
inherit pkgs commonFn mcCacheFn gentypeOutputFn;
|
||||
inherit pkgs commonFn mcFn gentypeOutputFn;
|
||||
};
|
||||
componentsFn = { pkgs, ... }:
|
||||
import ./nix/squiggle-components.nix { inherit pkgs commonFn mcCacheFn langFn; };
|
||||
import ./nix/squiggle-components.nix {
|
||||
inherit pkgs commonFn mcFn langFn;
|
||||
};
|
||||
websiteFn = { pkgs, ... }:
|
||||
import ./nix/squiggle-website.nix {
|
||||
inherit pkgs commonFn mcCacheFn langFn componentsFn;
|
||||
inherit pkgs commonFn mcFn langFn componentsFn;
|
||||
};
|
||||
|
||||
# local machines
|
||||
localFlake = { pkgs, ... }:
|
||||
let
|
||||
mcCache = mcCacheFn pkgs;
|
||||
mc = mcFn pkgs;
|
||||
lang = langFn pkgs;
|
||||
components = componentsFn pkgs;
|
||||
website = websiteFn pkgs;
|
||||
in {
|
||||
# validating
|
||||
checks = flake-utils.lib.flattenTree {
|
||||
wasm-lint = mc.rust-lint;
|
||||
wasm-headless-test = mc.firefox-test;
|
||||
lang-lint = lang.lint;
|
||||
lang-test = lang.test;
|
||||
components-lint = components.lint;
|
||||
|
@ -61,7 +66,8 @@
|
|||
# building
|
||||
packages = flake-utils.lib.flattenTree {
|
||||
default = website.docusaurus;
|
||||
mc-wasm = mcCache.mc-cached;
|
||||
mc-wasm = mc.lib;
|
||||
mc-wasm-pkg = mc.webpack-build-pkg;
|
||||
lang-bundle = lang.bundle;
|
||||
components = components.package-build;
|
||||
storybook = components.site-build;
|
||||
|
@ -70,7 +76,8 @@
|
|||
|
||||
# developing
|
||||
devShells = flake-utils.lib.flattenTree {
|
||||
default = (import ./nix/shell.nix { inherit pkgs cargo2nix; }).shell;
|
||||
default =
|
||||
(import ./nix/shell.nix { inherit pkgs cargo2nix; }).shell;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -79,6 +86,7 @@
|
|||
hciSystem = "x86_64-linux";
|
||||
hciPkgs = import nixpkgs { system = hciSystem; };
|
||||
effects = hercules-ci-effects.lib.withPkgs hciPkgs;
|
||||
mc = mcFn hciPkgs;
|
||||
lang = langFn hciPkgs;
|
||||
components = componentsFn hciPkgs;
|
||||
website = websiteFn hciPkgs;
|
||||
|
@ -86,6 +94,11 @@
|
|||
herculesCI = {
|
||||
ciSystems = [ hciSystem ];
|
||||
onPush = {
|
||||
wasm.outputs = {
|
||||
squiggle-wasm-lint = mc.rust-lint;
|
||||
squiggle-wasm-pkg = mc.webpack-build-pkg;
|
||||
squiggle-wasm-test-ff = mc.rust-firefox-test;
|
||||
};
|
||||
lang.outputs = {
|
||||
squiggle-lang-lint = lang.lint;
|
||||
squiggle-lang-build = lang.build;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
{ pkgs, commonFn, mcCacheFn, langFn }:
|
||||
{ pkgs, commonFn, mcFn, langFn }:
|
||||
|
||||
rec {
|
||||
common = commonFn pkgs;
|
||||
mcCache = mcCacheFn pkgs;
|
||||
mc = mcFn pkgs;
|
||||
lang = langFn pkgs;
|
||||
componentsPackageJson = let
|
||||
raw = pkgs.lib.importJSON ../packages/components/package.json;
|
||||
|
@ -12,11 +12,12 @@ rec {
|
|||
in pkgs.writeText "packages/components/patched-package.json"
|
||||
packageJsonString;
|
||||
yarn-source = pkgs.mkYarnPackage {
|
||||
name = "squiggle-components_source";
|
||||
name = "squiggle-components_yarnsource";
|
||||
buildInputs = common.buildInputs;
|
||||
src = ../packages/components;
|
||||
packageJSON = componentsPackageJson;
|
||||
yarnLock = ../yarn.lock;
|
||||
packageResolutions."@quri/squiggle-mc" = mc.webpack-build-pkg;
|
||||
packageResolutions."@quri/squiggle-lang" = lang.build;
|
||||
};
|
||||
lint = pkgs.stdenv.mkDerivation {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{ pkgs, commonFn, mcCacheFn, gentypeOutputFn }:
|
||||
{ pkgs, commonFn, mcFn, gentypeOutputFn }:
|
||||
|
||||
rec {
|
||||
common = commonFn pkgs;
|
||||
mcCache = mcCacheFn pkgs;
|
||||
mc = mcFn pkgs;
|
||||
yarn-source = pkgs.mkYarnPackage {
|
||||
name = "squiggle-lang_source";
|
||||
name = "squiggle-lang_yarnsource";
|
||||
src = ../packages/squiggle-lang;
|
||||
packageJSON = ../packages/squiggle-lang/package.json;
|
||||
yarnLock = ../yarn.lock;
|
||||
|
@ -23,8 +23,7 @@ rec {
|
|||
'';
|
||||
};
|
||||
bisect_ppx = {
|
||||
buildInputs =
|
||||
common.which; # ++ (with pkgs; [ ocaml nodePackages.esy ocamlPackages.bisect_ppx ]);
|
||||
buildInputs = common.which;
|
||||
postInstall = ''
|
||||
echo "PATCHELF'ING BISECT_PPX EXECUTABLE"
|
||||
THE_LD=$(patchelf --print-interpreter $(which mkdir))
|
||||
|
@ -39,7 +38,7 @@ rec {
|
|||
'';
|
||||
};
|
||||
};
|
||||
packageResolutions."@quri/par-cached-monte-carlo" = mcCache.mc-cached;
|
||||
packageResolutions."@quri/squiggle-mc" = mc.webpack-build-pkg;
|
||||
};
|
||||
lint = pkgs.stdenv.mkDerivation {
|
||||
name = "squiggle-lang-lint";
|
||||
|
|
46
nix/squiggle-mc.nix
Normal file
46
nix/squiggle-mc.nix
Normal file
|
@ -0,0 +1,46 @@
|
|||
{ pkgs, commonFn }:
|
||||
|
||||
rec {
|
||||
common = commonFn pkgs;
|
||||
rustPkgs = pkgs.rustBuilder.makePackageSet {
|
||||
rustVersion = "1.60.0";
|
||||
packageFun = import ../packages/mc/Cargo.nix;
|
||||
};
|
||||
yarn-source = pkgs.mkYarnPackage {
|
||||
name = "squiggle-mc_yarnsource";
|
||||
buildInputs = common.buildInputs;
|
||||
src = ../packages/mc;
|
||||
packageJSON = ../packages/mc/package.json;
|
||||
yarnLock = ../yarn.lock;
|
||||
};
|
||||
rust-lint = pkgs.stdenv.mkDerivation {
|
||||
name = "squiggle-mc-lint";
|
||||
src = yarn-source + "/libexec/@quri/squiggle-mc/deps/@quri/squiggle-mc";
|
||||
buildInputs = with pkgs; [ rustfmt ];
|
||||
buildPhase = "rustfmt --check src";
|
||||
installPhase = "mkdir -p $out";
|
||||
};
|
||||
lib = rustPkgs.workspace.quri-squiggle-mc { };
|
||||
webpack-build-pkg = pkgs.stdenv.mkDerivation {
|
||||
name = "squiggle-mc-build";
|
||||
src = yarn-source + "/libexec/@quri/squiggle-mc";
|
||||
buildInputs = common.buildInputs ++ (with pkgs; [ wasm-pack ]);
|
||||
buildPhase = ''
|
||||
pushd deps/@quri/squiggle-mc
|
||||
sed -i /pkg/d .gitignore
|
||||
yarn --offline build
|
||||
popd
|
||||
'';
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp -r deps/@quri/squiggle-mc/. $out
|
||||
'';
|
||||
};
|
||||
firefox-test = pkgs.stdenv.mkDerivation {
|
||||
name = "squiggle-mc-test";
|
||||
src = yarn-source + "/libexec/@quri/squiggle-mc/deps/@quri/squiggle-mc";
|
||||
buildInputs = common.buildInputs ++ (with pkgs; [ geckodriver cargo wasm-pack ]);
|
||||
buildPhase = "yarn --offline test -- --firefox";
|
||||
installPhase = "mkdir -p $out";
|
||||
};
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
{ pkgs }:
|
||||
|
||||
rec {
|
||||
rustPkgs = pkgs.rustBuilder.makePackageSet {
|
||||
rustVersion = "1.60.0";
|
||||
packageFun = import ./../packages/squiggle-mc-cached/Cargo.nix;
|
||||
};
|
||||
mc-cached = rustPkgs.workspace.squiggle-mc-cached-wasm {};
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
{ pkgs, commonFn, mcCacheFn, langFn, componentsFn }:
|
||||
{ pkgs, commonFn, mcFn, langFn, componentsFn }:
|
||||
|
||||
rec {
|
||||
common = commonFn pkgs;
|
||||
mcCache = mcCacheFn pkgs;
|
||||
mc = mcFn pkgs;
|
||||
lang = langFn pkgs;
|
||||
components = componentsFn pkgs;
|
||||
websitePackageJson = let
|
||||
|
@ -14,13 +14,13 @@ rec {
|
|||
packageJsonString = builtins.toJSON modified;
|
||||
in pkgs.writeText "packages/website/patched-package.json" packageJsonString;
|
||||
yarn-source = pkgs.mkYarnPackage {
|
||||
name = "squiggle-website_source";
|
||||
name = "squiggle-website_yarnsource";
|
||||
src = ../packages/website;
|
||||
packageJSON = websitePackageJson;
|
||||
yarnLock = ../yarn.lock;
|
||||
packageResolutions."@quri/squiggle-mc" = mc.webpack-build-pkg + "/pkg";
|
||||
packageResolutions."@quri/squiggle-lang" = lang.build;
|
||||
packageResolutions."@quri/squiggle-components" = components.package-build;
|
||||
workspaceDependencies = [ lang.yarn-source components.yarn-source ];
|
||||
};
|
||||
lint = pkgs.stdenv.mkDerivation {
|
||||
name = "squiggle-website-lint";
|
||||
|
|
5
packages/mc/.gitignore
vendored
Normal file
5
packages/mc/.gitignore
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
node_modules
|
||||
dist
|
||||
target
|
||||
pkg
|
||||
wasm-pack.log
|
|
@ -448,6 +448,28 @@ dependencies = [
|
|||
"proc-macro2 1.0.43",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quri-squiggle-mc"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"cached",
|
||||
"console_error_panic_hook",
|
||||
"futures 0.1.31",
|
||||
"getrandom",
|
||||
"js-sys",
|
||||
"kernel_density",
|
||||
"quickcheck",
|
||||
"quickcheck_macros",
|
||||
"rand 0.8.5",
|
||||
"rand_distr",
|
||||
"statistics",
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"wasm-bindgen-test",
|
||||
"web-sys",
|
||||
"wee_alloc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.3.23"
|
||||
|
@ -558,28 +580,6 @@ version = "1.0.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2"
|
||||
|
||||
[[package]]
|
||||
name = "squiggle-mc-cached-wasm"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"cached",
|
||||
"console_error_panic_hook",
|
||||
"futures 0.1.31",
|
||||
"getrandom",
|
||||
"js-sys",
|
||||
"kernel_density",
|
||||
"quickcheck",
|
||||
"quickcheck_macros",
|
||||
"rand 0.8.5",
|
||||
"rand_distr",
|
||||
"statistics",
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"wasm-bindgen-test",
|
||||
"web-sys",
|
||||
"wee_alloc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "statistics"
|
||||
version = "0.4.1"
|
|
@ -4,7 +4,7 @@
|
|||
args@{
|
||||
release ? true,
|
||||
rootFeatures ? [
|
||||
"squiggle-mc-cached-wasm/default"
|
||||
"quri-squiggle-mc/default"
|
||||
],
|
||||
rustPackages,
|
||||
buildRustPackages,
|
||||
|
@ -38,7 +38,7 @@ in
|
|||
{
|
||||
cargo2nixVersion = "0.11.0";
|
||||
workspace = {
|
||||
squiggle-mc-cached-wasm = rustPackages.unknown.squiggle-mc-cached-wasm."0.0.1";
|
||||
quri-squiggle-mc = rustPackages.unknown.quri-squiggle-mc."0.0.1";
|
||||
};
|
||||
"registry+https://github.com/rust-lang/crates.io-index".aho-corasick."0.7.18" = overridableMkRustCrate (profileName: rec {
|
||||
name = "aho-corasick";
|
||||
|
@ -659,6 +659,37 @@ in
|
|||
};
|
||||
});
|
||||
|
||||
"unknown".quri-squiggle-mc."0.0.1" = overridableMkRustCrate (profileName: rec {
|
||||
name = "quri-squiggle-mc";
|
||||
version = "0.0.1";
|
||||
registry = "unknown";
|
||||
src = fetchCrateLocal workspaceSrc;
|
||||
features = builtins.concatLists [
|
||||
(lib.optional (rootFeatures' ? "quri-squiggle-mc/default") "default")
|
||||
(lib.optional (rootFeatures' ? "quri-squiggle-mc/default" || rootFeatures' ? "quri-squiggle-mc/wee_alloc") "wee_alloc")
|
||||
];
|
||||
dependencies = {
|
||||
cached = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cached."0.38.0" { inherit profileName; };
|
||||
${ if false then "console_error_panic_hook" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".console_error_panic_hook."0.1.7" { inherit profileName; };
|
||||
getrandom = rustPackages."registry+https://github.com/rust-lang/crates.io-index".getrandom."0.2.7" { inherit profileName; };
|
||||
kernel_density = rustPackages."registry+https://github.com/rust-lang/crates.io-index".kernel_density."0.0.1" { inherit profileName; };
|
||||
rand = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rand."0.8.5" { inherit profileName; };
|
||||
rand_distr = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rand_distr."0.4.3" { inherit profileName; };
|
||||
statistics = rustPackages."registry+https://github.com/rust-lang/crates.io-index".statistics."0.4.1" { inherit profileName; };
|
||||
wasm_bindgen = rustPackages."registry+https://github.com/rust-lang/crates.io-index".wasm-bindgen."0.2.82" { inherit profileName; };
|
||||
web_sys = rustPackages."registry+https://github.com/rust-lang/crates.io-index".web-sys."0.3.59" { inherit profileName; };
|
||||
${ if rootFeatures' ? "quri-squiggle-mc/default" || rootFeatures' ? "quri-squiggle-mc/wee_alloc" then "wee_alloc" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".wee_alloc."0.4.5" { inherit profileName; };
|
||||
};
|
||||
devDependencies = {
|
||||
futures = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures."0.1.31" { inherit profileName; };
|
||||
js_sys = rustPackages."registry+https://github.com/rust-lang/crates.io-index".js-sys."0.3.59" { inherit profileName; };
|
||||
quickcheck = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quickcheck."1.0.3" { inherit profileName; };
|
||||
quickcheck_macros = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".quickcheck_macros."1.0.0" { profileName = "__noProfile"; };
|
||||
wasm_bindgen_futures = rustPackages."registry+https://github.com/rust-lang/crates.io-index".wasm-bindgen-futures."0.3.27" { inherit profileName; };
|
||||
wasm_bindgen_test = rustPackages."registry+https://github.com/rust-lang/crates.io-index".wasm-bindgen-test."0.2.50" { inherit profileName; };
|
||||
};
|
||||
});
|
||||
|
||||
"registry+https://github.com/rust-lang/crates.io-index".rand."0.3.23" = overridableMkRustCrate (profileName: rec {
|
||||
name = "rand";
|
||||
version = "0.3.23";
|
||||
|
@ -823,36 +854,6 @@ in
|
|||
src = fetchCratesIo { inherit name version; sha256 = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2"; };
|
||||
});
|
||||
|
||||
"unknown".squiggle-mc-cached-wasm."0.0.1" = overridableMkRustCrate (profileName: rec {
|
||||
name = "squiggle-mc-cached-wasm";
|
||||
version = "0.0.1";
|
||||
registry = "unknown";
|
||||
src = fetchCrateLocal workspaceSrc;
|
||||
features = builtins.concatLists [
|
||||
(lib.optional (rootFeatures' ? "squiggle-mc-cached-wasm/wee_alloc") "wee_alloc")
|
||||
];
|
||||
dependencies = {
|
||||
cached = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cached."0.38.0" { inherit profileName; };
|
||||
${ if false then "console_error_panic_hook" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".console_error_panic_hook."0.1.7" { inherit profileName; };
|
||||
getrandom = rustPackages."registry+https://github.com/rust-lang/crates.io-index".getrandom."0.2.7" { inherit profileName; };
|
||||
kernel_density = rustPackages."registry+https://github.com/rust-lang/crates.io-index".kernel_density."0.0.1" { inherit profileName; };
|
||||
rand = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rand."0.8.5" { inherit profileName; };
|
||||
rand_distr = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rand_distr."0.4.3" { inherit profileName; };
|
||||
statistics = rustPackages."registry+https://github.com/rust-lang/crates.io-index".statistics."0.4.1" { inherit profileName; };
|
||||
wasm_bindgen = rustPackages."registry+https://github.com/rust-lang/crates.io-index".wasm-bindgen."0.2.82" { inherit profileName; };
|
||||
web_sys = rustPackages."registry+https://github.com/rust-lang/crates.io-index".web-sys."0.3.59" { inherit profileName; };
|
||||
${ if rootFeatures' ? "squiggle-mc-cached-wasm/wee_alloc" then "wee_alloc" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".wee_alloc."0.4.5" { inherit profileName; };
|
||||
};
|
||||
devDependencies = {
|
||||
futures = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures."0.1.31" { inherit profileName; };
|
||||
js_sys = rustPackages."registry+https://github.com/rust-lang/crates.io-index".js-sys."0.3.59" { inherit profileName; };
|
||||
quickcheck = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quickcheck."1.0.3" { inherit profileName; };
|
||||
quickcheck_macros = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".quickcheck_macros."1.0.0" { profileName = "__noProfile"; };
|
||||
wasm_bindgen_futures = rustPackages."registry+https://github.com/rust-lang/crates.io-index".wasm-bindgen-futures."0.3.27" { inherit profileName; };
|
||||
wasm_bindgen_test = rustPackages."registry+https://github.com/rust-lang/crates.io-index".wasm-bindgen-test."0.2.50" { inherit profileName; };
|
||||
};
|
||||
});
|
||||
|
||||
"registry+https://github.com/rust-lang/crates.io-index".statistics."0.4.1" = overridableMkRustCrate (profileName: rec {
|
||||
name = "statistics";
|
||||
version = "0.4.1";
|
||||
|
@ -1139,14 +1140,14 @@ in
|
|||
registry = "registry+https://github.com/rust-lang/crates.io-index";
|
||||
src = fetchCratesIo { inherit name version; sha256 = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e"; };
|
||||
features = builtins.concatLists [
|
||||
(lib.optional (rootFeatures' ? "squiggle-mc-cached-wasm/wee_alloc") "default")
|
||||
(lib.optional (rootFeatures' ? "squiggle-mc-cached-wasm/wee_alloc") "size_classes")
|
||||
(lib.optional (rootFeatures' ? "quri-squiggle-mc/default" || rootFeatures' ? "quri-squiggle-mc/wee_alloc") "default")
|
||||
(lib.optional (rootFeatures' ? "quri-squiggle-mc/default" || rootFeatures' ? "quri-squiggle-mc/wee_alloc") "size_classes")
|
||||
];
|
||||
dependencies = {
|
||||
${ if rootFeatures' ? "squiggle-mc-cached-wasm/wee_alloc" then "cfg_if" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."0.1.10" { inherit profileName; };
|
||||
${ if rootFeatures' ? "squiggle-mc-cached-wasm/wee_alloc" && hostPlatform.isUnix && !(hostPlatform.parsed.cpu.name == "wasm32") then "libc" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.132" { inherit profileName; };
|
||||
${ if rootFeatures' ? "squiggle-mc-cached-wasm/wee_alloc" then "memory_units" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".memory_units."0.4.0" { inherit profileName; };
|
||||
${ if rootFeatures' ? "squiggle-mc-cached-wasm/wee_alloc" && hostPlatform.parsed.kernel.name == "windows" then "winapi" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.9" { inherit profileName; };
|
||||
${ if rootFeatures' ? "quri-squiggle-mc/default" || rootFeatures' ? "quri-squiggle-mc/wee_alloc" then "cfg_if" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."0.1.10" { inherit profileName; };
|
||||
${ if (rootFeatures' ? "quri-squiggle-mc/default" || rootFeatures' ? "quri-squiggle-mc/wee_alloc") && hostPlatform.isUnix && !(hostPlatform.parsed.cpu.name == "wasm32") then "libc" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.132" { inherit profileName; };
|
||||
${ if rootFeatures' ? "quri-squiggle-mc/default" || rootFeatures' ? "quri-squiggle-mc/wee_alloc" then "memory_units" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".memory_units."0.4.0" { inherit profileName; };
|
||||
${ if (rootFeatures' ? "quri-squiggle-mc/default" || rootFeatures' ? "quri-squiggle-mc/wee_alloc") && hostPlatform.parsed.kernel.name == "windows" then "winapi" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.9" { inherit profileName; };
|
||||
};
|
||||
});
|
||||
|
||||
|
@ -1156,12 +1157,12 @@ in
|
|||
registry = "registry+https://github.com/rust-lang/crates.io-index";
|
||||
src = fetchCratesIo { inherit name version; sha256 = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"; };
|
||||
features = builtins.concatLists [
|
||||
(lib.optional (rootFeatures' ? "squiggle-mc-cached-wasm/wee_alloc") "memoryapi")
|
||||
(lib.optional (rootFeatures' ? "quri-squiggle-mc/default" || rootFeatures' ? "quri-squiggle-mc/wee_alloc") "memoryapi")
|
||||
[ "minwindef" ]
|
||||
[ "ntsecapi" ]
|
||||
[ "profileapi" ]
|
||||
(lib.optional (rootFeatures' ? "squiggle-mc-cached-wasm/wee_alloc") "synchapi")
|
||||
(lib.optional (rootFeatures' ? "squiggle-mc-cached-wasm/wee_alloc") "winbase")
|
||||
(lib.optional (rootFeatures' ? "quri-squiggle-mc/default" || rootFeatures' ? "quri-squiggle-mc/wee_alloc") "synchapi")
|
||||
(lib.optional (rootFeatures' ? "quri-squiggle-mc/default" || rootFeatures' ? "quri-squiggle-mc/wee_alloc") "winbase")
|
||||
[ "winnt" ]
|
||||
];
|
||||
dependencies = {
|
|
@ -1,6 +1,6 @@
|
|||
# You must change these to your own details.
|
||||
[package]
|
||||
name = "squiggle-mc-cached-wasm"
|
||||
name = "quri-squiggle-mc"
|
||||
description = "Cached and parallel Monte Carlo simulations in WebAssembly"
|
||||
version = "0.0.1"
|
||||
authors = ["Quinn <quinn@quantifieduncertainty.org>"]
|
||||
|
@ -20,13 +20,17 @@ lto = true
|
|||
|
||||
[features]
|
||||
# If you uncomment this line, it will enable `wee_alloc`:
|
||||
#default = ["wee_alloc"]
|
||||
default = ["wee_alloc"]
|
||||
|
||||
[dependencies]
|
||||
# The `wasm-bindgen` crate provides the bare minimum functionality needed
|
||||
# to interact with JavaScript.
|
||||
wasm-bindgen = "0.2.45"
|
||||
|
||||
# The `web-sys` crate allows you to interact with the various browser APIs,
|
||||
# like the DOM.
|
||||
web-sys = { version = "0.3.59", features = ["console"] }
|
||||
|
||||
# `wee_alloc` is a tiny allocator for wasm that is only ~1K in code size
|
||||
# compared to the default allocator's ~10K. However, it is slower than the default
|
||||
# allocator, so it's not enabled by default.
|
||||
|
@ -40,12 +44,6 @@ statistics = "0.4.1"
|
|||
kernel_density = "0.0.1"
|
||||
cached = { version = "0.38.0", features = ["wasm"] }
|
||||
|
||||
# The `web-sys` crate allows you to interact with the various browser APIs,
|
||||
# like the DOM.
|
||||
[dependencies.web-sys]
|
||||
version = "0.3.22"
|
||||
features = ["console"]
|
||||
|
||||
# The `console_error_panic_hook` crate provides better debugging of panics by
|
||||
# logging them with `console.error`. This is great for development, but requires
|
||||
# all the `std::fmt` and `std::panicking` infrastructure, so it's only enabled
|
|
@ -1,8 +1,10 @@
|
|||
# `@quri/par-cached-monte-carlo` - parallel Monte Carlo with memoization
|
||||
# `@quri/squiggle-mc` - parallel Monte Carlo with memoization for the `@quri/squiggle-lang` javascript interface
|
||||
|
||||
## How to install
|
||||
|
||||
Please run `yarn` at hte monorepo level
|
||||
Please run `yarn` at the monorepo level.
|
||||
|
||||
In this subrepo, please run `./cargo-refresh-nix.sh` every time `Cargo.toml`/`Cargo.lock` is modified, it requires nix with flakes.
|
||||
|
||||
## How to run in debug mode
|
||||
|
||||
|
@ -20,6 +22,8 @@ yarn build
|
|||
|
||||
## How to run unit tests
|
||||
|
||||
These are the headless browser tests, which will attempt to download and install drivers, and may fail.
|
||||
|
||||
```sh
|
||||
# Runs tests in Firefox
|
||||
yarn test -- --firefox
|
2
packages/mc/cargo-refresh-nix.sh
Executable file
2
packages/mc/cargo-refresh-nix.sh
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/usr/bin/env bash
|
||||
nix run github:cargo2nix/cargo2nix
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"author": "Quinn Dougherty <quinnd@riseup.net>",
|
||||
"name": "@quri/par-cached-monte-carlo",
|
||||
"name": "@quri/squiggle-mc",
|
||||
"version": "0.0.1",
|
||||
"scripts": {
|
||||
"build": "rimraf dist pkg && webpack",
|
|
@ -41,7 +41,7 @@
|
|||
],
|
||||
"author": "Quantified Uncertainty Research Institute",
|
||||
"dependencies": {
|
||||
"@quri/par-cached-monte-carlo": "file:../squiggle-mc-cached/pkg",
|
||||
"@quri/squiggle-mc": "^0.0.1",
|
||||
"@rescript/std": "^9.1.4",
|
||||
"@stdlib/stats": "^0.0.13",
|
||||
"jstat": "^1.9.5",
|
||||
|
|
5
packages/squiggle-mc-cached/.gitignore
vendored
5
packages/squiggle-mc-cached/.gitignore
vendored
|
@ -1,5 +0,0 @@
|
|||
node_modules
|
||||
/dist
|
||||
/target
|
||||
/pkg
|
||||
/wasm-pack.log
|
|
@ -1,2 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
cargo2nix
|
Loading…
Reference in New Issue
Block a user