tried to get the nixification to work
This commit is contained in:
parent
07c3004c82
commit
84f0cfd3b0
21
flake.lock
21
flake.lock
|
@ -126,6 +126,26 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"naersk": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1659610603,
|
||||||
|
"narHash": "sha256-LYgASYSPYo7O71WfeUOaEUzYfzuXm8c8eavJcel+pfI=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "naersk",
|
||||||
|
"rev": "c6a45e4277fa58abd524681466d3450f896dc094",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "naersk",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1660496378,
|
"lastModified": 1660496378,
|
||||||
|
@ -147,6 +167,7 @@
|
||||||
"flake-utils": "flake-utils_2",
|
"flake-utils": "flake-utils_2",
|
||||||
"gentype": "gentype",
|
"gentype": "gentype",
|
||||||
"hercules-ci-effects": "hercules-ci-effects",
|
"hercules-ci-effects": "hercules-ci-effects",
|
||||||
|
"naersk": "naersk",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
49
flake.nix
49
flake.nix
|
@ -3,6 +3,10 @@
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "nixpkgs/nixos-22.05";
|
nixpkgs.url = "nixpkgs/nixos-22.05";
|
||||||
|
naersk = {
|
||||||
|
url = "github:nix-community/naersk";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
cargo2nix = {
|
cargo2nix = {
|
||||||
url = "github:cargo2nix/cargo2nix/release-0.11.0";
|
url = "github:cargo2nix/cargo2nix/release-0.11.0";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
@ -21,18 +25,33 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, gentype, hercules-ci-effects, cargo2nix
|
outputs = { self, nixpkgs, gentype, hercules-ci-effects, naersk, cargo2nix
|
||||||
, flake-utils, ... }:
|
, flake-utils, ... }:
|
||||||
let
|
let
|
||||||
version = builtins.substring 0 8 self.lastModifiedDate;
|
version = builtins.substring 0 8 self.lastModifiedDate;
|
||||||
|
crossSystemForWasmPkgs = {
|
||||||
|
config = "wasm32-unknown-wasi-unknown";
|
||||||
|
system = "wasm32-wasi";
|
||||||
|
useLLVM = true;
|
||||||
|
};
|
||||||
|
overlays = [
|
||||||
|
cargo2nix.overlays.default
|
||||||
|
(final: prev: {
|
||||||
|
# set the node version here
|
||||||
|
nodejs = prev.nodejs-18_x;
|
||||||
|
# The override is the only way to get it into mkYarnModules
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
commonFn = pkgs: {
|
commonFn = pkgs: {
|
||||||
buildInputs = with pkgs; [ nodejs yarn ];
|
buildInputs = with pkgs; [ nodejs yarn ];
|
||||||
prettier = with pkgs.nodePackages; [ prettier ];
|
prettier = with pkgs.nodePackages; [ prettier ];
|
||||||
which = [ pkgs.which ];
|
which = [ pkgs.which ];
|
||||||
};
|
};
|
||||||
|
naerskFn = { pkgs, rust, ... }: pkgs.callPackage naersk { cargo = rust; rustc = rust; };
|
||||||
gentypeOutputFn = pkgs: gentype.outputs.packages.${pkgs.system}.default;
|
gentypeOutputFn = pkgs: gentype.outputs.packages.${pkgs.system}.default;
|
||||||
mcFn = { pkgs, ... }:
|
mcFn = { pkgs, wasmPkgs, ... }:
|
||||||
import ./nix/squiggle-mc.nix { inherit pkgs commonFn; };
|
import ./nix/squiggle-mc.nix { inherit pkgs wasmPkgs commonFn naerskFn; };
|
||||||
langFn = { pkgs, ... }:
|
langFn = { pkgs, ... }:
|
||||||
import ./nix/squiggle-lang.nix {
|
import ./nix/squiggle-lang.nix {
|
||||||
inherit pkgs commonFn mcFn gentypeOutputFn;
|
inherit pkgs commonFn mcFn gentypeOutputFn;
|
||||||
|
@ -47,9 +66,9 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
# local machines
|
# local machines
|
||||||
localFlake = { pkgs, ... }:
|
localFlake = { pkgs, wasmPkgs, ... }:
|
||||||
let
|
let
|
||||||
mc = mcFn pkgs;
|
mc = mcFn { inherit pkgs wasmPkgs; };
|
||||||
lang = langFn pkgs;
|
lang = langFn pkgs;
|
||||||
components = componentsFn pkgs;
|
components = componentsFn pkgs;
|
||||||
website = websiteFn pkgs;
|
website = websiteFn pkgs;
|
||||||
|
@ -67,6 +86,7 @@
|
||||||
packages = flake-utils.lib.flattenTree {
|
packages = flake-utils.lib.flattenTree {
|
||||||
default = website.docusaurus;
|
default = website.docusaurus;
|
||||||
mc-wasm = mc.lib;
|
mc-wasm = mc.lib;
|
||||||
|
mc-wasm2 = mc.lib2;
|
||||||
mc-wasm-pkg = mc.webpack-build-pkg;
|
mc-wasm-pkg = mc.webpack-build-pkg;
|
||||||
lang-bundle = lang.bundle;
|
lang-bundle = lang.bundle;
|
||||||
components = components.package-build;
|
components = components.package-build;
|
||||||
|
@ -85,8 +105,9 @@
|
||||||
herc = let
|
herc = let
|
||||||
hciSystem = "x86_64-linux";
|
hciSystem = "x86_64-linux";
|
||||||
hciPkgs = import nixpkgs { system = hciSystem; };
|
hciPkgs = import nixpkgs { system = hciSystem; };
|
||||||
|
hciPkgsWasm = import nixpkgs { system = hciSystem; crossSystem = crossSystemForWasmPkgs; overlays = overlays; };
|
||||||
effects = hercules-ci-effects.lib.withPkgs hciPkgs;
|
effects = hercules-ci-effects.lib.withPkgs hciPkgs;
|
||||||
mc = mcFn hciPkgs;
|
mc = mcFn hciPkgs hciPkgsWasm;
|
||||||
lang = langFn hciPkgs;
|
lang = langFn hciPkgs;
|
||||||
components = componentsFn hciPkgs;
|
components = componentsFn hciPkgs;
|
||||||
website = websiteFn hciPkgs;
|
website = websiteFn hciPkgs;
|
||||||
|
@ -122,15 +143,13 @@
|
||||||
# globals
|
# globals
|
||||||
pkgs = import nixpkgs {
|
pkgs = import nixpkgs {
|
||||||
inherit system;
|
inherit system;
|
||||||
overlays = [
|
overlays = overlays;
|
||||||
cargo2nix.overlays.default
|
};
|
||||||
(final: prev: {
|
pkgsWasm = import nixpkgs {
|
||||||
# set the node version here
|
inherit system;
|
||||||
nodejs = prev.nodejs-18_x;
|
overlays = overlays;
|
||||||
# The override is the only way to get it into mkYarnModules
|
crossSystem = crossSystemForWasmPkgs;
|
||||||
})
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
in localFlake pkgs) // herc;
|
in localFlake { pkgs = pkgs; wasmPkgs = pkgsWasm; }) // herc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ with pkgs; {
|
||||||
nodejs
|
nodejs
|
||||||
rustup
|
rustup
|
||||||
pkg-config
|
pkg-config
|
||||||
openssl
|
libressl
|
||||||
nixfmt
|
nixfmt
|
||||||
rustfmt
|
rustfmt
|
||||||
cargo2nix.outputs.packages.${pkgs.system}.default
|
cargo2nix.outputs.packages.${pkgs.system}.default
|
||||||
|
|
|
@ -1,11 +1,30 @@
|
||||||
{ pkgs, commonFn }:
|
{ pkgs, wasmPkgs, commonFn, naerskFn }:
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
common = commonFn pkgs;
|
common = commonFn pkgs;
|
||||||
rustPkgs = pkgs.rustBuilder.makePackageSet {
|
|
||||||
rustVersion = "1.60.0";
|
rustVersion = "1.61.0";
|
||||||
packageFun = import ../packages/mc/Cargo.nix;
|
wasmTarget = "wasm32-unknown-unknown";
|
||||||
|
rust = pkgs.rust-bin.stable.${rustVersion}.default.override {
|
||||||
|
targets = [ wasmTarget ];
|
||||||
};
|
};
|
||||||
|
naersk = naerskFn { inherit pkgs rust; };
|
||||||
|
mc-pkg = naersk.buildPackage {
|
||||||
|
src = ../packages/mc;
|
||||||
|
copyLibs = true;
|
||||||
|
copyBins = true;
|
||||||
|
CARGO_BUILD_TARGET = wasmTarget;
|
||||||
|
nativeBuildInputs = common.buildInputs;
|
||||||
|
};
|
||||||
|
lib2 = mc-pkg;
|
||||||
|
|
||||||
|
rustPkgsWasm = wasmPkgs.rustBuilder.makePackageSet {
|
||||||
|
rustVersion = rustVersion;
|
||||||
|
packageFun = import ../packages/mc/Cargo.nix;
|
||||||
|
target = wasmTarget;
|
||||||
|
};
|
||||||
|
lib = (rustPkgsWasm.workspace.quri-squiggle-mc { }).out;
|
||||||
|
|
||||||
yarn-source = pkgs.mkYarnPackage {
|
yarn-source = pkgs.mkYarnPackage {
|
||||||
name = "squiggle-mc_yarnsource";
|
name = "squiggle-mc_yarnsource";
|
||||||
buildInputs = common.buildInputs;
|
buildInputs = common.buildInputs;
|
||||||
|
@ -20,7 +39,6 @@ rec {
|
||||||
buildPhase = "rustfmt --check src";
|
buildPhase = "rustfmt --check src";
|
||||||
installPhase = "mkdir -p $out";
|
installPhase = "mkdir -p $out";
|
||||||
};
|
};
|
||||||
lib = rustPkgs.workspace.quri-squiggle-mc { };
|
|
||||||
webpack-build-pkg = pkgs.stdenv.mkDerivation {
|
webpack-build-pkg = pkgs.stdenv.mkDerivation {
|
||||||
name = "squiggle-mc-build";
|
name = "squiggle-mc-build";
|
||||||
src = yarn-source + "/libexec/@quri/squiggle-mc";
|
src = yarn-source + "/libexec/@quri/squiggle-mc";
|
||||||
|
|
|
@ -10,6 +10,13 @@ categories = ["wasm", "Monte Carlo"]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
[package.metadata.wasm-pack.profile.dev]
|
||||||
|
wasm-opt = false
|
||||||
|
[package.metadata.wasm-pack.profile.profiling]
|
||||||
|
wasm-opt = false
|
||||||
|
[package.metadata.wasm-pack.profile.release]
|
||||||
|
wasm-opt = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib"]
|
crate-type = ["cdylib"]
|
||||||
|
|
||||||
|
@ -21,6 +28,7 @@ lto = true
|
||||||
[features]
|
[features]
|
||||||
# If you uncomment this line, it will enable `wee_alloc`:
|
# If you uncomment this line, it will enable `wee_alloc`:
|
||||||
default = ["wee_alloc"]
|
default = ["wee_alloc"]
|
||||||
|
# wasm-bindgen = [ "instant/wasm-bindgen" ]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# The `wasm-bindgen` crate provides the bare minimum functionality needed
|
# The `wasm-bindgen` crate provides the bare minimum functionality needed
|
||||||
|
|
|
@ -2504,9 +2504,6 @@
|
||||||
resolved "https://registry.yarnpkg.com/@polka/url/-/url-1.0.0-next.21.tgz#5de5a2385a35309427f6011992b544514d559aa1"
|
resolved "https://registry.yarnpkg.com/@polka/url/-/url-1.0.0-next.21.tgz#5de5a2385a35309427f6011992b544514d559aa1"
|
||||||
integrity sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g==
|
integrity sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g==
|
||||||
|
|
||||||
"@quri/par-cached-monte-carlo@file:packages/squiggle-mc-cached/pkg":
|
|
||||||
version "0.0.0"
|
|
||||||
|
|
||||||
"@quri/squiggle-components@^0.2.23":
|
"@quri/squiggle-components@^0.2.23":
|
||||||
version "0.2.24"
|
version "0.2.24"
|
||||||
resolved "https://registry.yarnpkg.com/@quri/squiggle-components/-/squiggle-components-0.2.24.tgz#16a2d72fb16f46a0bf71388c85d1238927676923"
|
resolved "https://registry.yarnpkg.com/@quri/squiggle-components/-/squiggle-components-0.2.24.tgz#16a2d72fb16f46a0bf71388c85d1238927676923"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user