Skip to content

feat: Stylus tools #300

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
devShells.zkwasm = import ./shells/zkwasm.nix { pkgs = final; };
devShells.sp1 = import ./shells/sp1.nix { pkgs = final; };
devShells.risc0 = import ./shells/risc0.nix { pkgs = final; };
devShells.stylus = import ./shells/stylus.nix { pkgs = final; };
};
};
}
10 changes: 10 additions & 0 deletions packages/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
cardano-cli
pkgs-with-rust-overlay
rust-bin-2024-08-01
unstable-pkgs
;
python3Packages = pkgs.python3Packages;

Expand Down Expand Up @@ -119,6 +120,10 @@
graphql = callPackage ./graphql/default.nix { inherit cardano-cli cardano-node; };
cardano = callPackage ./cardano/default.nix { inherit cardano-cli cardano-node graphql; };

foundry = callPackage ./foundry/default.nix { inherit unstable-pkgs; };
cargo-stylus = callPackage ./cargo-stylus/default.nix { inherit unstable-pkgs; };
nitro-devnode = callPackage ./nitro-devnode/default.nix { inherit foundry; };

polkadot-generic = callPackage ./polkadot/default.nix {
craneLib = craneLib-stable;
inherit (darwin) libiconv;
Expand Down Expand Up @@ -189,6 +194,11 @@
{
legacyPackages.metacraft-labs =
rec {

inherit foundry;
inherit cargo-stylus;
inherit nitro-devnode;

gaiad = callPackage ./gaiad { };
cosmos-theta-testnet = callPackage ./cosmos-theta-testnet { inherit gaiad; };
blst = callPackage ./blst { };
Expand Down
38 changes: 38 additions & 0 deletions packages/cargo-stylus/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
unstable-pkgs,
...
}:
with unstable-pkgs;
rustPlatform.buildRustPackage rec {
pname = "cargo-stylus";
version = "0.5.8";

src = fetchFromGitHub {
owner = "OffchainLabs";
repo = pname;
rev = "v${version}";
hash = "sha256-+wHGGzd4GWWmHnxset90s9FAzOjF7VMr58HZHUB+OwQ=";
};

cargoLock = {
lockFile = "${src}/Cargo.lock";
};

buildInputs = [
cargo
openssl
];

nativeBuildInputs = [
pkg-config
];

meta = {
description = "Cargo subcommand for developing Arbitrum Stylus projects in Rust.";
homepage = "https://github.com/OffchainLabs/cargo-stylus";
license = [
lib.licenses.mit
lib.licenses.asl20
];
};
}
3 changes: 3 additions & 0 deletions packages/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
in
pkgs.extend rust-overlay;

unstable-pkgs = inputs.nixpkgs-unstable.legacyPackages.${system};

rust-stable = pkgs-with-rust-overlay.rust-bin.stable.latest.default.override {
extensions = [ "rust-src" ];
targets = [
Expand Down Expand Up @@ -90,6 +92,7 @@
craneLib-stable
craneLib-nightly
pkgs-with-rust-overlay
unstable-pkgs
;

rust-bin-2024-08-01 = inputs.rust-overlay-2024-08-01.lib.mkRustBin { } pkgs;
Expand Down
39 changes: 39 additions & 0 deletions packages/foundry/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
unstable-pkgs,
...
}:
with unstable-pkgs;
rustPlatform.buildRustPackage rec {
pname = "foundry";
version = "1.0.0";

src = fetchFromGitHub {
owner = "foundry-rs";
repo = pname;
rev = "v${version}";
hash = "sha256-YTsneUj5OPw7EyKZMFLJJeAtZoD0je1DdmfMjVju4L8=";
};

solc-bin-json = fetchurl {
url = "https://raw.githubusercontent.com/ethereum/solc-bin/f5f39aa9f399dbd24e2dcbccb9e277c573a49d1b/linux-amd64/list.json";
hash = "sha256-uiVRa6ewZDd1W62Vp5GGruJDO+fH8G8abVkz3XZZ/u8=";
};

cargoLock = {
lockFile = "${src}/Cargo.lock";
};

doCheck = false;

SVM_RELEASES_LIST_JSON = "${solc-bin-json}";

meta = {
description = "Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.";
homepage = "https://github.com/foundry-rs/foundry";
license = [
lib.licenses.mit
lib.licenses.asl20
];
maintainers = [ ];
};
}
36 changes: 36 additions & 0 deletions packages/nitro-devnode/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
foundry,
pkgs,
stdenv,
}:
with pkgs;
stdenv.mkDerivation rec {
pname = "nitro-devnode";
version = "dd51c52";

src = fetchFromGitHub {
owner = "OffchainLabs";
repo = "nitro-devnode";
rev = "dd51c52129276f940632a4c4bf13844a93499a9f";
hash = "sha256-0ppC05xfVOrcn2yATni3n3oh4A8MEMdgvhs8E2wNsr8=";
};

buildInputs = [
bash
docker
foundry
];

buildPhase = ''
mkdir -p $out/bin
cp ${src}/run-dev-node.sh $out/bin/run-nitro-devnode
'';

meta = {
description = "A script for running an Arbitrum Nitro dev node and deploying contracts for testing.";
homepage = "https://github.com/OffchainLabs/nitro-devnode";
license = [
lib.licenses.asl20
];
};
}
9 changes: 9 additions & 0 deletions shells/stylus.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{ pkgs, ... }:
with pkgs;
mkShell {
packages = [
metacraft-labs.foundry
metacraft-labs.cargo-stylus
metacraft-labs.nitro-devnode
];
}
Loading