From 71c4f4046965fcd022802aa5e065c446a4ba6055 Mon Sep 17 00:00:00 2001 From: monyarm Date: Wed, 1 Feb 2023 10:56:28 +0200 Subject: [PATCH 1/4] initial zkllvm --- overlay.nix | 3 +++ packages/zkllvm/default.nix | 18 ++++++++++++++++++ shell.nix | 2 ++ 3 files changed, 23 insertions(+) create mode 100644 packages/zkllvm/default.nix diff --git a/overlay.nix b/overlay.nix index eb9fd2b4..df6aa8d2 100644 --- a/overlay.nix +++ b/overlay.nix @@ -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; @@ -50,5 +52,6 @@ in { inherit cattrs22-2; inherit elrond-go; inherit elrond-proxy-go; + inherit zkllvm; }; } diff --git a/packages/zkllvm/default.nix b/packages/zkllvm/default.nix new file mode 100644 index 00000000..408069cc --- /dev/null +++ b/packages/zkllvm/default.nix @@ -0,0 +1,18 @@ +{pkgs}: +pkgs.clangStdenv.mkDerivation rec { + name = "zkllvm-${version}"; + version = "0.0.32"; + + src = fetchgit { + url = "https://github.com/nilfoundation/zkllvm"; + sha256 = lib.fakeSha256; + rev = "v${version}"; + }; + + buildInputs = [cmake boost.dev openssl.dev]; + + meta = with pkgs.lib; { + homepage = "https://github.com/nilfoundation/zkllvm"; + platforms = with platforms; linux ++ darwin; + }; +} diff --git a/shell.nix b/shell.nix index a8046f2f..847ab6d5 100644 --- a/shell.nix +++ b/shell.nix @@ -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 From 61a568b727c3dff71ec3ab5a8996f0e0b9709e8a Mon Sep 17 00:00:00 2001 From: monyarm Date: Wed, 8 Feb 2023 15:18:39 +0200 Subject: [PATCH 2/4] zkllvm version bump and build phase redux --- packages/zkllvm/default.nix | 43 +++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/packages/zkllvm/default.nix b/packages/zkllvm/default.nix index 408069cc..4e347ba9 100644 --- a/packages/zkllvm/default.nix +++ b/packages/zkllvm/default.nix @@ -1,18 +1,33 @@ -{pkgs}: -pkgs.clangStdenv.mkDerivation rec { - name = "zkllvm-${version}"; - version = "0.0.32"; +{ + lib, + fetchgit, + pkgs, + clang13Stdenv, +}: +clang13Stdenv.mkDerivation rec { + pname = "zkllvm"; + version = "0.0.34"; - src = fetchgit { - url = "https://github.com/nilfoundation/zkllvm"; - sha256 = lib.fakeSha256; - rev = "v${version}"; - }; + src = + (fetchgit { + url = "https://github.com/nilfoundation/zkllvm.git"; + rev = "v${version}"; + sha256 = "sha256-cNR7xjsf57n/ItIFKr0U1EOEPwrjuz29kynhk5Ubj9U="; + fetchSubmodules = true; + deepClone = true; + }) + .overrideAttrs (_: { + GIT_CONFIG_COUNT = 1; + GIT_CONFIG_KEY_0 = "url.https://github.com/.insteadOf"; + GIT_CONFIG_VALUE_0 = "git@github.com:"; + }); - buildInputs = [cmake boost.dev openssl.dev]; + buildPhase = '' + cmake -G "Unix Makefiles" -B build -DCMAKE_BUILD_TYPE=Release -DCIRCUIT_ASSEMBLY_OUTPUT=TRUE . + make assigner clang -j$(nproc) + ''; - meta = with pkgs.lib; { - homepage = "https://github.com/nilfoundation/zkllvm"; - platforms = with platforms; linux ++ darwin; - }; + nativeBuildInputs = with pkgs; [pkgconfig cmake python3 git]; + + buildInputs = with pkgs; [boost openssl llvmPackages_13.llvm]; } From 29713562017d03f89dbab372851867b61c925ba1 Mon Sep 17 00:00:00 2001 From: monyarm Date: Thu, 23 Feb 2023 10:03:03 +0200 Subject: [PATCH 3/4] version bump to 0.0.40 --- packages/zkllvm/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/zkllvm/default.nix b/packages/zkllvm/default.nix index 4e347ba9..11e0066d 100644 --- a/packages/zkllvm/default.nix +++ b/packages/zkllvm/default.nix @@ -6,13 +6,13 @@ }: clang13Stdenv.mkDerivation rec { pname = "zkllvm"; - version = "0.0.34"; + version = "0.0.40"; src = (fetchgit { url = "https://github.com/nilfoundation/zkllvm.git"; rev = "v${version}"; - sha256 = "sha256-cNR7xjsf57n/ItIFKr0U1EOEPwrjuz29kynhk5Ubj9U="; + sha256 = "sha256-F67euvWuM3eG9GJ4OH8yvSNE3pxJcFmnGrbUcX1BPqc="; fetchSubmodules = true; deepClone = true; }) From bcb58d9e9e4ca0323f2d683d428eaf53a11f7da1 Mon Sep 17 00:00:00 2001 From: monyarm Date: Mon, 30 Oct 2023 17:07:42 +0200 Subject: [PATCH 4/4] commiting a working version --- packages/zkllvm/default.nix | 63 +++++++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 24 deletions(-) diff --git a/packages/zkllvm/default.nix b/packages/zkllvm/default.nix index 11e0066d..2353cb7f 100644 --- a/packages/zkllvm/default.nix +++ b/packages/zkllvm/default.nix @@ -3,31 +3,46 @@ fetchgit, pkgs, clang13Stdenv, -}: -clang13Stdenv.mkDerivation rec { - pname = "zkllvm"; - version = "0.0.40"; +}: 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 = "git@github.com:"; + }); - src = - (fetchgit { - url = "https://github.com/nilfoundation/zkllvm.git"; - rev = "v${version}"; - sha256 = "sha256-F67euvWuM3eG9GJ4OH8yvSNE3pxJcFmnGrbUcX1BPqc="; - fetchSubmodules = true; - deepClone = true; - }) - .overrideAttrs (_: { - GIT_CONFIG_COUNT = 1; - GIT_CONFIG_KEY_0 = "url.https://github.com/.insteadOf"; - GIT_CONFIG_VALUE_0 = "git@github.com:"; - }); + postPatch = '' + sed -i 's#set(ZKLLVM_DEV_ENVIRONMENT TRUE)#set(ZKLLVM_DEV_ENVIRONMENT TRUE)\nset(ZKLLVM_VERSION \"${version}\")#' CMakeLists.txt + ''; - buildPhase = '' - cmake -G "Unix Makefiles" -B build -DCMAKE_BUILD_TYPE=Release -DCIRCUIT_ASSEMBLY_OUTPUT=TRUE . - make assigner clang -j$(nproc) - ''; + buildPhase = '' + mkdir build + cmake -G "Unix Makefiles" -B build -DCMAKE_BUILD_TYPE=Release -DCIRCUIT_ASSEMBLY_OUTPUT=TRUE . - nativeBuildInputs = with pkgs; [pkgconfig cmake python3 git]; + make -j$(nproc) + make assigner clang -j$(nproc) + # make rslang -j$(nproc) + ls bbuild + ''; - buildInputs = with pkgs; [boost openssl llvmPackages_13.llvm]; -} + nativeBuildInputs = with pkgs; [pkgconfig cmake python3 git]; + + buildInputs = with pkgs; [boost-custom spdlog icu openssl llvmPackages_13.llvm git]; + }