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

Fix some Nix flake issues #402

Merged
merged 7 commits into from
Jun 28, 2024
Merged
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
29 changes: 11 additions & 18 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,27 @@
let
pkgs = import nixpkgs { inherit system; };
stdenv = pkgs.llvmPackages_16.stdenv;
crypto3 = nil_crypto3.packages.${system}.default;
in rec {
packages = rec {
crypto3 = nil_crypto3.packages.${pkgs.system}.default;
zkllvm-blueprint = stdenv.mkDerivation {
name = "zkllvm-blueprint";

src = self;

env.CXXFLAGS = toString ([ "-fPIC" ]);

buildInputs = with pkgs; [
cmake
pkg-config
clang_16
boost183
];

# Because crypto3 is header-only, we must propagate it so users
# of this flake must not specify crypto3 in their derivations manually
propagatedBuildInputs = [ crypto3 ];
propagatedBuildInputs = [ crypto3 pkgs.boost183 ];

cmakeFlags =
[ "-DCMAKE_BUILD_TYPE=Release"
"-DCMAKE_CXX_STANDARD=17" ];
cmakeBuildType = "Release";

cmakeFlags = [
"-DCMAKE_CXX_STANDARD=17"
];

doCheck = false;
};
Expand Down Expand Up @@ -117,27 +114,23 @@

checks = {
default = stdenv.mkDerivation {
# TODO: rewrite this using overrideAttrs on makePackage
name = "zkllvm-blueprint-tests";

src = self;

env.CXXFLAGS = toString ([ "-fPIC" ]);

buildInputs = with pkgs; [
cmake
ninja
pkg-config
clang_16
boost183
packages.crypto3
crypto3
];

cmakeBuildType = "Debug";

cmakeFlags = [
"-DCMAKE_CXX_STANDARD=17"
"-DBUILD_SHARED_LIBS=TRUE"
"-DCMAKE_ENABLE_TESTS=TRUE"
"-DCMAKE_C_COMPILER=clang"
"-DCMAKE_CXX_COMPILER=clang++"
Expand Down Expand Up @@ -168,7 +161,7 @@
boost183
clang_16
clang-tools_16
packages.crypto3
crypto3
];

shellHook = ''
Expand All @@ -189,9 +182,9 @@
}

# 1 build crypto 3 locally with the command 'nix build -L .?submodules=1#'
# 2 redirect to the local build of crypto3: 'nix develop --redirect .#crypto3 /your/path/to/crypto3/result/'
# 2 use the local source of crypto3: 'nix develop --override-input nil_crypto3 /your/path/to/crypto3 .?submodules=1#'
# 3a to build all in blueprint: 'nix flake -L check .?submodules=1#' or build all and run tests: nix build -L .?submodules=1#checks.x86_64-linux.default
# 3b to build individual targets:
# nix develop . -c cmake -B build -DCMAKE_CXX_STANDARD=17 -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=FALSE -DCMAKE_ENABLE_TESTS=TRUE -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
# nix develop . -c cmake -B build -DCMAKE_CXX_STANDARD=17 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_ENABLE_TESTS=TRUE -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
# cd build
# nix develop ../ -c cmake --build . -t blueprint_verifiers_flexible_constant_pow_test