Compare commits
2
Commits
e8df22fe06
...
f008d0cc60
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f008d0cc60 | ||
|
|
81daddfd70 |
Generated
+16
@@ -1,5 +1,20 @@
|
|||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"crane": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1791754810,
|
||||||
|
"narHash": "sha256-cN0Mgk+sQtCJcGWs9H4M0CnLRAuC4I8aCwiBTcBJs6E=",
|
||||||
|
"owner": "ipetkov",
|
||||||
|
"repo": "crane",
|
||||||
|
"rev": "bd63bf1d0a0f6dcacd7549c714a671ee63b0db6a",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "ipetkov",
|
||||||
|
"repo": "crane",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"flake-utils": {
|
"flake-utils": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"systems": "systems"
|
"systems": "systems"
|
||||||
@@ -36,6 +51,7 @@
|
|||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"crane": "crane",
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"rust-overlay": "rust-overlay"
|
"rust-overlay": "rust-overlay"
|
||||||
|
|||||||
@@ -6,9 +6,10 @@
|
|||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
rust-overlay.url = "github:oxalica/rust-overlay";
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||||
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
|
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
crane.url = "github:ipetkov/crane";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { nixpkgs, flake-utils, rust-overlay, ... }:
|
outputs = { nixpkgs, flake-utils, rust-overlay, crane, ... }:
|
||||||
flake-utils.lib.eachSystem flake-utils.lib.allSystems (system:
|
flake-utils.lib.eachSystem flake-utils.lib.allSystems (system:
|
||||||
let
|
let
|
||||||
pkgs = import nixpkgs {
|
pkgs = import nixpkgs {
|
||||||
@@ -20,13 +21,28 @@
|
|||||||
targets = [ "wasm32-wasip2" ];
|
targets = [ "wasm32-wasip2" ];
|
||||||
extensions = [ "rust-src" ];
|
extensions = [ "rust-src" ];
|
||||||
};
|
};
|
||||||
rustPlatform = pkgs.makeRustPlatform { cargo = rust; rustc = rust; };
|
# Crane builds the dependencies once (`cargoArtifacts`, keyed only on
|
||||||
sausage = rustPlatform.buildRustPackage {
|
# Cargo.toml/Cargo.lock), so a change to our own crates rebuilds
|
||||||
|
# just them.
|
||||||
|
craneLib = (crane.mkLib pkgs).overrideToolchain rust;
|
||||||
|
common = {
|
||||||
pname = "sausage";
|
pname = "sausage";
|
||||||
version = "0.1.0";
|
version = "0.1.0";
|
||||||
src = ./.;
|
src = ./.;
|
||||||
cargoLock.lockFile = ./Cargo.lock;
|
};
|
||||||
cargoBuildFlags = [ "-p" "sausage" ];
|
# The test packages for `checks.tests`.
|
||||||
|
testPackages = "-p sausage -p sausage-actor -p agent";
|
||||||
|
cargoArtifacts = craneLib.buildDepsOnly (common // {
|
||||||
|
doCheck = false;
|
||||||
|
# The dependencies of the host binary and of the tests.
|
||||||
|
buildPhaseCargoCommand = ''
|
||||||
|
cargoWithProfile build --locked -p sausage
|
||||||
|
cargoWithProfile test --locked --no-run ${testPackages}
|
||||||
|
'';
|
||||||
|
});
|
||||||
|
sausage = craneLib.buildPackage (common // {
|
||||||
|
inherit cargoArtifacts;
|
||||||
|
cargoExtraArgs = "--locked -p sausage";
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
nativeBuildInputs = [ pkgs.makeWrapper ];
|
nativeBuildInputs = [ pkgs.makeWrapper ];
|
||||||
# The `cargo` actor runs cargo at runtime. Build scripts need a C linker.
|
# The `cargo` actor runs cargo at runtime. Build scripts need a C linker.
|
||||||
@@ -34,7 +50,7 @@
|
|||||||
wrapProgram $out/bin/sausage --prefix PATH : ${pkgs.lib.makeBinPath [ rust pkgs.stdenv.cc ]}
|
wrapProgram $out/bin/sausage --prefix PATH : ${pkgs.lib.makeBinPath [ rust pkgs.stdenv.cc ]}
|
||||||
'';
|
'';
|
||||||
meta.mainProgram = "sausage";
|
meta.mainProgram = "sausage";
|
||||||
};
|
});
|
||||||
# `nix run .#loop -- <world>` runs the newest `sausage run <world>`
|
# `nix run .#loop -- <world>` runs the newest `sausage run <world>`
|
||||||
# (without a folder: bare `sausage`, i.e. ./world, created if needed)
|
# (without a folder: bare `sausage`, i.e. ./world, created if needed)
|
||||||
# from the public repo, again and again: after a crash or a broker
|
# from the public repo, again and again: after a crash or a broker
|
||||||
@@ -62,10 +78,14 @@
|
|||||||
# `nix flake check` runs every test of the host, the SDK, and the
|
# `nix flake check` runs every test of the host, the SDK, and the
|
||||||
# agent. The tests build WASM actors with cargo, offline, from the
|
# agent. The tests build WASM actors with cargo, offline, from the
|
||||||
# vendored crates of Cargo.lock.
|
# vendored crates of Cargo.lock.
|
||||||
checks.tests = sausage.overrideAttrs (old: {
|
# The binary the host loop runs (`nix run`), built from the same
|
||||||
pname = "sausage-tests";
|
# cached dependencies as the tests.
|
||||||
doCheck = true;
|
checks.package = sausage;
|
||||||
cargoTestFlags = [ "-p" "sausage" "-p" "sausage-actor" "-p" "agent" ];
|
checks.tests = craneLib.cargoTest (common // {
|
||||||
|
inherit cargoArtifacts;
|
||||||
|
cargoExtraArgs = "--locked ${testPackages}";
|
||||||
|
# Nothing builds on the test run's target folder: don't store it.
|
||||||
|
doInstallCargoArtifacts = false;
|
||||||
preCheck = ''
|
preCheck = ''
|
||||||
# Its own lock file pins crates that the vendored set may lack.
|
# Its own lock file pins crates that the vendored set may lack.
|
||||||
rm -f cli/tests/actors/toolbox/Cargo.lock
|
rm -f cli/tests/actors/toolbox/Cargo.lock
|
||||||
|
|||||||
Reference in New Issue
Block a user