Skip to content

Zkllvm #36

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
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
3 changes: 3 additions & 0 deletions overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ _finalNixpkgs: prevNixpkgs: let
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 {};

zkllvm = prevNixpkgs.callPackage ./packages/zkllvm/default.nix {};
in {
metacraft-labs = rec {
solana = solana-full-sdk;
Expand All @@ -50,5 +52,6 @@ in {
inherit cattrs22-2;
inherit elrond-go;
inherit elrond-proxy-go;
inherit zkllvm;
};
}
48 changes: 48 additions & 0 deletions packages/zkllvm/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
lib,
fetchgit,
pkgs,
clang13Stdenv,
}: let
boost-custom = pkgs.boost.override {
enableShared = false;
enableStatic = true;
enableIcu = true;
};
in
clang13Stdenv.mkDerivation rec {
pname = "zkllvm";
version = "0.1.3";
src =
(fetchgit {
url = "https://github.com/nilfoundation/zkllvm.git";
rev = "v${version}";
sha256 = "sha256-rPbG2xRQAIJv4YSTXMxLWUhG3EKT62X3zOMeVsgic6Q=";
fetchSubmodules = true;
deepClone = true;
leaveDotGit = true;
})
.overrideAttrs (_: {
GIT_CONFIG_COUNT = 1;
GIT_CONFIG_KEY_0 = "url.https://github.com/.insteadOf";
GIT_CONFIG_VALUE_0 = "[email protected]:";
});

postPatch = ''
sed -i 's#set(ZKLLVM_DEV_ENVIRONMENT TRUE)#set(ZKLLVM_DEV_ENVIRONMENT TRUE)\nset(ZKLLVM_VERSION \"${version}\")#' CMakeLists.txt
'';

buildPhase = ''
mkdir build
cmake -G "Unix Makefiles" -B build -DCMAKE_BUILD_TYPE=Release -DCIRCUIT_ASSEMBLY_OUTPUT=TRUE .

make -j$(nproc)
make assigner clang -j$(nproc)
# make rslang -j$(nproc)
ls bbuild
'';

nativeBuildInputs = with pkgs; [pkgconfig cmake python3 git];

buildInputs = with pkgs; [boost-custom spdlog icu openssl llvmPackages_13.llvm git];
}
2 changes: 2 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ with pkgs;
metacraft-labs.cosmos-theta-testnet
metacraft-labs.circom
metacraft-labs.circ

metacraft-labs.zkllvm
]
++ lib.optionals (!stdenv.isDarwin) [
# Solana is still not compatible with macOS on M1
Expand Down