Skip to content
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

Feat/mythril #68

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
12 changes: 6 additions & 6 deletions flake.lock

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

11 changes: 9 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,15 @@
flake-parts.lib.mkFlake {inherit inputs;} {
systems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
imports = [./packages];
perSystem = {final, ...}: {
devShells.default = import ./shell.nix {pkgs = final;};
perSystem = {
final,
self',
...
}: {
devShells.default = import ./shell.nix {
pkgs = final;
inherit self';
};
};
};
}
143 changes: 143 additions & 0 deletions overlay.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
_finalNixpkgs: prevNixpkgs: let
solana-rust-artifacts = prevNixpkgs.callPackage ./packages/solana-rust-artifacts {};

solana-bpf-tools = prevNixpkgs.callPackage ./packages/solana-bpf-tools {};

solana-full-sdk = prevNixpkgs.callPackage ./packages/solana-full-sdk {
inherit solana-rust-artifacts solana-bpf-tools;
};

cosmos-theta-testnet = prevNixpkgs.callPackage ./packages/cosmos-theta-testnet {};

circom = prevNixpkgs.callPackage ./packages/circom/default.nix {};
circ = prevNixpkgs.callPackage ./packages/circ/default.nix {};

wasmd = prevNixpkgs.callPackage ./packages/wasmd/default.nix {};

# erdpy depends on cattrs >= 22.2
cattrs22-2 = prevNixpkgs.python3Packages.cattrs.overridePythonAttrs (previousAttrs: rec {
version = "22.2.0";

src = prevNixpkgs.fetchFromGitHub {
owner = "python-attrs";
repo = "cattrs";
rev = "v${version}";
hash = "sha256-Qnrq/mIA/t0mur6IAen4vTmMIhILWS6v5nuf+Via2hA=";
};

patches = [];
});

# https://discourse.nixos.org/t/inconsistent-vendoring-in-buildgomodule-when-overriding-source/9225/6
go-ethereum-capella = prevNixpkgs.go-ethereum.override rec {
buildGoModule = args:
prevNixpkgs.buildGoModule (args
// {
version = "1.11.1";
src = prevNixpkgs.fetchFromGitHub {
owner = "ethereum";
repo = "go-ethereum";
rev = "v1.11.1";
sha256 = "sha256-mYLxwJ0oiKfiz+NZ5bnlY0h2uq5wbeQKrwoCCw23Bg0=";
};
subPackages = builtins.filter (x: x != "cmd/puppeth") args.subPackages;
vendorSha256 = "sha256-6yLkeT5DrAPUohAmobssKkvxgXI8kACxiu17WYbw+n0=";
});
};

# copied from https://github.com/NixOS/nixpkgs/blob/8df7949791250b580220eb266e72e77211bedad9/pkgs/development/python-modules/cryptography/default.nix
cryptography36 = prevNixpkgs.callPackage ./packages/python-modules/cryptography36/default.nix {};

ledgercomm = prevNixpkgs.callPackage ./packages/python-modules/ledgercomm/default.nix {};
requests-cache = prevNixpkgs.callPackage ./packages/python-modules/requests-cache/default.nix {};

erdpy = prevNixpkgs.callPackage ./packages/erdpy/default.nix {};
elrond-go = prevNixpkgs.callPackage ./packages/elrond-go/default.nix {};
elrond-proxy-go = prevNixpkgs.callPackage ./packages/elrond-proxy-go/default.nix {};

go-opera = prevNixpkgs.callPackage ./packages/go-opera/default.nix {};

leap = prevNixpkgs.callPackage ./packages/leap/default.nix {};
eos-vm = prevNixpkgs.callPackage ./packages/eos-vm/default.nix {};
cdt = prevNixpkgs.callPackage ./packages/cdt/default.nix {};

nimbus = prevNixpkgs.callPackage ./packages/nimbus/default.nix {};

pistache = prevNixpkgs.callPackage ./packages/pistache/default.nix {};
ffiasm-src = prevNixpkgs.callPackage ./packages/ffiasm/src.nix {};
zqfield = prevNixpkgs.callPackage ./packages/ffiasm/zqfield.nix {
inherit ffiasm-src;
};
# Pairing Groups on BN-254, aka alt_bn128
# Source:
# https://zips.z.cash/protocol/protocol.pdf (section 5.4.9.1)
# See also:
# https://eips.ethereum.org/EIPS/eip-196
# https://eips.ethereum.org/EIPS/eip-197
# https://hackmd.io/@aztec-network/ByzgNxBfd
# https://hackmd.io/@jpw/bn254
zqfield-bn254 = prevNixpkgs.symlinkJoin {
name = "zqfield-bn254";
paths = [
(zqfield {
primeNumber = "21888242871839275222246405745257275088696311157297823662689037894645226208583";
name = "Fq";
})
(zqfield
{
primeNumber = "21888242871839275222246405745257275088548364400416034343698204186575808495617";
name = "Fr";
})
];
};
ffiasm = prevNixpkgs.callPackage ./packages/ffiasm/default.nix {
inherit ffiasm-src zqfield-bn254;
};
circom_runtime = prevNixpkgs.callPackage ./packages/circom_runtime/default.nix {};
rapidsnark = prevNixpkgs.callPackage ./packages/rapidsnark/default.nix {
inherit ffiasm zqfield-bn254;
};
rapidsnark-server = prevNixpkgs.callPackage ./packages/rapidsnark-server/default.nix {
inherit ffiasm zqfield-bn254 rapidsnark pistache;
};
in {
metacraft-labs = rec {
solana = solana-full-sdk;
inherit cosmos-theta-testnet;
inherit circom;

# Disabled until cvc4 compiles again
# inherit circ;

inherit wasmd;
inherit ledgercomm;
inherit cryptography36;
inherit requests-cache;
inherit erdpy;
inherit cattrs22-2;

# Disabled until elrond-go can build with Go >= 1.19
# inherit elrond-go;
# inherit elrond-proxy-go;
inherit go-opera;
inherit leap;
inherit eos-vm;
inherit cdt;

# Ethereum
inherit nimbus;
inherit go-ethereum-capella;

inherit pistache;
inherit zqfield-bn254;
inherit zqfield;
inherit ffiasm;
inherit circom_runtime;
inherit rapidsnark;
inherit rapidsnark-server;

inherit mythril;
inherit blake2b-py;
inherit py-solc-x;
};
}
43 changes: 12 additions & 31 deletions packages/all-packages.nix
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{...}: {
{inputs, ...}: {
imports = [inputs.flake-parts.flakeModules.easyOverlay ./python-modules];
perSystem = {
pkgs,
self',
...
}: let
inherit (pkgs) lib darwin hostPlatform symlinkJoin fetchFromGitHub;
inherit (pkgs) lib darwin hostPlatform symlinkJoin fetchFromGitHub python3Packages;
inherit (pkgs.lib) optionalAttrs callPackageWith;
inherit (self'.legacyPackages) rustPlatformStable;
python3Packages = pkgs.python3Packages;

inherit (self'.legacyPackages) rustPlatformStable rustPlatformNightly;
callPackage = callPackageWith (pkgs // {rustPlatform = rustPlatformStable;});
darwinPkgs = {
inherit (darwin.apple_sdk.frameworks) Foundation;
};
python-modules = self'.legacyPackages.python-modules;

# RapidSnark
ffiasm-src = callPackage ./ffiasm/src.nix {};
Expand Down Expand Up @@ -49,36 +49,20 @@
};

# Elrond / MultiversX
# copied from https://github.com/NixOS/nixpkgs/blob/8df7949791250b580220eb266e72e77211bedad9/pkgs/development/python-modules/cryptography/default.nix
cattrs22-2 = pkgs.python3Packages.cattrs.overrideAttrs (finalAttrs: previousAttrs: {
version = "22.2.0";

src = fetchFromGitHub {
owner = "python-attrs";
repo = "cattrs";
rev = "v22.2.0";
hash = "sha256-Qnrq/mIA/t0mur6IAen4vTmMIhILWS6v5nuf+Via2hA=";
};

patches = [];
});
cryptography36 = callPackage ./python-modules/cryptography36/default.nix {};

py-ecc = callPackage ./python-modules/py-ecc/default.nix {
inherit (python3Packages) buildPythonPackage cached-property eth-typing eth-utils mypy-extensions pytestCheckHook pythonOlder;
erdpy = callPackage ./erdpy/default.nix {
inherit elrond-go elrond-proxy-go;
inherit (python-modules) cryptography36 ledgercomm requests-cache;
};

ledgercomm = callPackage ./python-modules/ledgercomm/default.nix {};
requests-cache = callPackage ./python-modules/requests-cache/default.nix {inherit cattrs22-2;};

corepack-shims = callPackage ./corepack-shims/default.nix {};

erdpy = callPackage ./erdpy/default.nix {inherit cryptography36 elrond-go elrond-proxy-go ledgercomm requests-cache;};
elrond-go = callPackage ./elrond-go/default.nix {};
elrond-proxy-go = callPackage ./elrond-proxy-go/default.nix {};

corepack-shims = callPackage ./corepack-shims/default.nix {};
in {
legacyPackages.metacraft-labs =
rec {
inherit (python-modules) mythril;

cosmos-theta-testnet = callPackage ./cosmos-theta-testnet {};

circom = callPackage ./circom/default.nix {};
Expand Down Expand Up @@ -131,9 +115,6 @@
inherit solana-rust-artifacts solana-bpf-tools;
};

inherit cryptography36;

inherit py-ecc;
inherit corepack-shims;
# inherit erdpy elrond-go elrond-proxy-go;

Expand Down
10 changes: 9 additions & 1 deletion packages/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
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"];
};
in {
packages = self'.legacyPackages.metacraft-labs;

Expand All @@ -22,12 +26,16 @@
legacyPackages = {
nix2container = inputs'.nix2container.packages.nix2container;

rust-stable = rust-stable;
inherit rust-stable rust-nightly;

rustPlatformStable = pkgs.makeRustPlatform {
rustc = rust-stable;
cargo = rust-stable;
};
rustPlatformNightly = pkgs.makeRustPlatform {
rustc = rust-nightly;
cargo = rust-nightly;
};
};
};
}
Loading