diff --git a/packages/all-packages.nix b/packages/all-packages.nix index 2740ffd3..3f1d51f5 100644 --- a/packages/all-packages.nix +++ b/packages/all-packages.nix @@ -9,6 +9,7 @@ inherit (self'.legacyPackages) rustPlatformStable + rustPlatformNightly craneLib-stable cardano-node cardano-cli @@ -103,6 +104,8 @@ }; polkadot = polkadot-generic {}; polkadot-fast = polkadot-generic {enableFastRuntime = true;}; + + zokrates = callPackage ./zokrates/default.nix {rustPlatform = rustPlatformNightly."2022-07-01";}; in { legacyPackages.metacraft-labs = rec { @@ -148,6 +151,8 @@ # Polkadot inherit polkadot polkadot-fast; + + inherit zokrates; } // lib.optionalAttrs hostPlatform.isLinux rec { wasmd = callPackage ./wasmd/default.nix {}; diff --git a/packages/default.nix b/packages/default.nix index 9c9bee56..82be9143 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -13,6 +13,14 @@ extensions = ["rust-src"]; targets = ["wasm32-wasi" "wasm32-unknown-unknown"]; }; + rust-nightly = pkgs-extended.rust-bin.nightly.latest.default.override { + extensions = ["rust-src"]; + targets = ["wasm32-wasi" "wasm32-unknown-unknown"]; + }; + rust-nightly-2022-07-01 = pkgs-extended.rust-bin.nightly."2022-07-01".default.override { + extensions = ["rust-src"]; + targets = ["wasm32-wasi" "wasm32-unknown-unknown"]; + }; in { packages = self'.legacyPackages.metacraft-labs; @@ -24,12 +32,24 @@ nix2container = inputs'.nix2container.packages.nix2container; inherit (inputs'.cardano-node.packages) cardano-node cardano-cli; - inherit rust-stable craneLib-stable; + inherit rust-stable craneLib-stable rust-nightly; rustPlatformStable = pkgs.makeRustPlatform { rustc = rust-stable; cargo = rust-stable; }; + + rustPlatformNightly = + (pkgs.makeRustPlatform { + rustc = rust-nightly; + cargo = rust-nightly; + }) + // { + "2022-07-01" = pkgs.makeRustPlatform { + rustc = rust-nightly-2022-07-01; + cargo = rust-nightly-2022-07-01; + }; + }; }; }; } diff --git a/packages/zokrates/default.nix b/packages/zokrates/default.nix new file mode 100644 index 00000000..54114d1c --- /dev/null +++ b/packages/zokrates/default.nix @@ -0,0 +1,31 @@ +{ + lib, + fetchgit, + pkgs, + rustPlatform, +}: +with pkgs; + rustPlatform.buildRustPackage rec { + pname = "zokrates"; + version = "0.8.7"; + cargoBuildFlags = "-p zokrates_cli"; + + src = fetchgit { + url = "https://github.com/Zokrates/ZoKrates.git"; + rev = "0.8.7"; + hash = "sha256-Ew7MYJg3Mxz05ngL0sZEuPijxzaHhliK9GIho1GTFr8="; + }; + + cargoLock = { + lockFile = "${src}/Cargo.lock"; + outputHashes = { + "ark-marlin-0.3.0" = "sha256-dc4StG8FEDrxVuo00M/uF6SRi5rpTx4I2PnmKtVJTLI="; + "phase2-0.2.2" = "sha256-eONGJEK6g2DN6dKL86vMVx/Md63u5E2Qzv4tpek0NzM="; + }; + }; + + nativeBuildInputs = [pkg-config]; + PKG_CONFIG_PATH = "${openssl.dev}/lib/pkgconfig"; + + buildInputs = []; + } diff --git a/shell.nix b/shell.nix index 8ac430f6..6f52e2d2 100644 --- a/shell.nix +++ b/shell.nix @@ -34,6 +34,8 @@ in metacraft-labs.polkadot metacraft-labs.polkadot-fast + + metacraft-labs.zokrates ] ++ lib.optionals (stdenv.hostPlatform.isx86) [ metacraft-labs.rapidsnark