Skip to content

Commit

Permalink
Merge pull request #184 from cspr-rad/update-flake
Browse files Browse the repository at this point in the history
Update flake inputs
  • Loading branch information
marijanp authored Aug 27, 2024
2 parents 7125919 + 6943df8 commit 7aaee83
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 58 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ members = [
]

[workspace.package]
name = "kairos"
version = "0.1.0"
edition = "2021"
license = "MIT OR Apache-2.0"
Expand Down
54 changes: 24 additions & 30 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 14 additions & 15 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,18 @@
./kairos-prover
./nixos
];
perSystem = { self', inputs', system, pkgs, lib, ... }:
perSystem = { self', inputs', pkgs, lib, ... }:
let
rustToolchain = with inputs'.fenix.packages; combine [
stable.toolchain
targets.wasm32-unknown-unknown.stable.rust-std
];
craneLib = inputs.crane.lib.${system}.overrideToolchain rustToolchain;
craneLib = (inputs.crane.mkLib pkgs).overrideToolchain rustToolchain;

cctl = inputs'.cctl.packages.cctl.override { casper-node = inputs'.csprpkgs.packages.casper-node; };

kairosContractsAttrs = {
pname = "kairos-contracts";
src = lib.cleanSourceWith {
src = lib.fileset.toSource {
root = ./.;
Expand Down Expand Up @@ -87,6 +88,7 @@
};

kairosSessionCodeAttrs = {
pname = "kairos-session-code";
src = lib.cleanSourceWith {
src = lib.fileset.toSource {
root = ./.;
Expand Down Expand Up @@ -136,6 +138,7 @@
'';

kairosNodeAttrs = {
pname = "kairos";
src = lib.fileset.toSource {
root = ./.;
fileset = lib.fileset.unions [
Expand Down Expand Up @@ -182,7 +185,6 @@
{
devShells.default = pkgs.mkShell {
# Rust Analyzer needs to be able to find the path to default crate
RUST_SRC_PATH = "${rustToolchain}/lib/rustlib/src/rust/library";
CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_LINKER = "lld";
PATH_TO_WASM_BINARIES = "${self'.packages.kairos-contracts}/bin";
PATH_TO_SESSION_BINARIES = "${self'.packages.kairos-session-code}/bin";
Expand All @@ -194,46 +196,40 @@
};

packages = {
kairos-deps = craneLib.buildDepsOnly (kairosNodeAttrs // {
pname = "kairos-deps";
});
kairos-deps = craneLib.buildDepsOnly kairosNodeAttrs;

kairos = craneLib.buildPackage (kairosNodeAttrs // {
pname = "kairos";
cargoArtifacts = self'.packages.kairos-deps;
});

kairos-tx-no-std = craneLib.buildPackage (kairosNodeAttrs // {
pname = "kairos-tx-no-std";
cargoArtifacts = self'.packages.kairos-deps;
cargoExtraArgs = "-p kairos-tx --no-default-features";
});

kairos-crypto-no-std = craneLib.buildPackage (kairosNodeAttrs // {
pname = "kairos-crypto-no-std";
cargoArtifacts = self'.packages.kairos-deps;
cargoExtraArgs = "-p kairos-crypto --no-default-features --features crypto-casper,tx";
});

default = self'.packages.kairos;

kairos-docs = craneLib.cargoDoc (kairosNodeAttrs // {
pname = "kairos-docs";
cargoArtifacts = self'.packages.kairos-deps;
});

kairos-contracts-deps = craneLib.buildDepsOnly (kairosContractsAttrs // {
pname = "kairos-contracts-deps";
});
kairos-contracts-deps = craneLib.buildDepsOnly kairosContractsAttrs;

kairos-contracts = craneLib.buildPackage (kairosContractsAttrs // {
pname = "kairos-contracts";
cargoArtifacts = self'.packages.kairos-contracts-deps;
});

kairos-session-code-deps = craneLib.buildDepsOnly (kairosSessionCodeAttrs // {
pname = "kairos-session-code-deps";
});
kairos-session-code-deps = craneLib.buildDepsOnly kairosSessionCodeAttrs;

kairos-session-code = craneLib.buildPackage (kairosSessionCodeAttrs // {
pname = "kairos-session-code";
cargoArtifacts = self'.packages.kairos-session-code-deps;
});

Expand All @@ -249,6 +245,7 @@

checks = {
lint = craneLib.cargoClippy (kairosNodeAttrs // {
pname = "kairos-lint";
cargoArtifacts = self'.packages.kairos-deps;
cargoClippyExtraArgs = "--features=all-tests --all-targets -- --deny warnings";
});
Expand Down Expand Up @@ -277,11 +274,13 @@
# };

kairos-contracts-lint = craneLib.cargoClippy (kairosContractsAttrs // {
pname = "kairos-contracts-lint";
cargoArtifacts = self'.packages.kairos-contracts-deps;
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
});

kairos-session-code-lint = craneLib.cargoClippy (kairosSessionCodeAttrs // {
pname = "kairos-session-code-lint";
cargoArtifacts = self'.packages.kairos-session-code-deps;
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
});
Expand Down
1 change: 0 additions & 1 deletion kairos-contracts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ members = [
]

[workspace.package]
name = "kairos-contracts"
version = "0.1.0"
edition = "2021"
license = "MIT OR Apache-2.0"
Expand Down
1 change: 0 additions & 1 deletion kairos-prover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ members = [
]

[workspace.package]
name = "kairos-prover"
version = "0.1.0"
edition = "2021"
license = "MIT OR Apache-2.0"
Expand Down
13 changes: 5 additions & 8 deletions kairos-prover/default.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{ inputs, ... }:
{
perSystem = { self', inputs', system, pkgs, lib, ... }:
perSystem = { self', inputs', pkgs, lib, ... }:
let
rustToolchain = inputs'.fenix.packages.latest.toolchain;
craneLib = inputs.crane.lib.${system}.overrideToolchain rustToolchain;
craneLib = (inputs.crane.mkLib pkgs).overrideToolchain rustToolchain;

kairosProverAttrs = rec {
pname = "kairos-prover";
src = lib.fileset.toSource {
root = ../.;
fileset = lib.fileset.unions [
Expand All @@ -19,7 +20,6 @@
sourceRoot = "source/kairos-prover";
nativeBuildInputs = with pkgs; [
pkg-config
cargo-risczero
];
buildInputs = with pkgs; [
openssl.dev
Expand All @@ -28,7 +28,7 @@
darwin.apple_sdk.frameworks.SystemConfiguration
darwin.apple_sdk.frameworks.Metal
];
cargoVendorDir = inputs.crane.lib.${system}.vendorMultipleCargoDeps {
cargoVendorDir = craneLib.vendorMultipleCargoDeps {
inherit (craneLib.findCargoFiles src) cargoConfigs;
cargoLockList = [
./Cargo.lock
Expand Down Expand Up @@ -66,12 +66,9 @@
inputsFrom = [ self'.packages.kairos-prover ];
};
packages = {
kairos-prover-deps = craneLib.buildDepsOnly (kairosProverAttrs // {
pname = "kairos-prover-deps";
});
kairos-prover-deps = craneLib.buildDepsOnly kairosProverAttrs;

kairos-prover = craneLib.buildPackage (kairosProverAttrs // {
pname = "kairos-prover";
cargoArtifacts = self'.packages.kairos-prover-deps;
meta.mainProgram = "kairos-prover-risc0-server";
});
Expand Down
1 change: 0 additions & 1 deletion kairos-session-code/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ members = [
]

[workspace.package]
name = "kairos-contracts"
version = "0.1.0"
edition = "2021"
license = "MIT OR Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion nixos/tests/end-to-end.nix
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ nixosTest {
extraPythonPackages = p: [ p.backoff ];
testScript = { nodes }:
let
casperNodeAddress = "http://localhost:${builtins.toString nodes.server.config.services.cctl.port}";
casperNodeAddress = "http://localhost:${builtins.toString nodes.server.services.cctl.port}";
# This is the directory wget will copy to, see script below
clientUsersDirectory = "kairos/cctl/users";
in
Expand Down

0 comments on commit 7aaee83

Please sign in to comment.