Skip to content
Merged
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
32 changes: 20 additions & 12 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@
};

outputs =
inputs@{ flake-parts, nixos-modules, ... }:
inputs@{
flake-parts,
nixos-modules,
nixpkgs,
...
}:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"x86_64-linux"
Expand All @@ -45,26 +50,29 @@
];
perSystem =
{
final,
self',
config,
system,
pkgs,
...
}:
{
_module.args.pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
devShells.default = import ./shells/all.nix {
pkgs = final;
inherit self';
inherit pkgs self';
};
devShells.ci = import ./shells/ci.nix {
pkgs = final;
inherit config;
inherit pkgs config;
};
devShells.nexus = import ./shells/nexus.nix { pkgs = final; };
devShells.jolt = import ./shells/jolt.nix { pkgs = final; };
devShells.zkm = import ./shells/zkm.nix { pkgs = final; };
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.nexus = import ./shells/nexus.nix { inherit pkgs config; };
devShells.jolt = import ./shells/jolt.nix { inherit pkgs config; };
devShells.zkm = import ./shells/zkm.nix { inherit pkgs config; };
devShells.zkwasm = import ./shells/zkwasm.nix { inherit pkgs config; };
devShells.sp1 = import ./shells/sp1.nix { inherit pkgs config; };
devShells.risc0 = import ./shells/risc0.nix { inherit pkgs config; };
};
};
}
5 changes: 4 additions & 1 deletion packages/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
rapidsnark = callPackage ./rapidsnark/default.nix {
inherit ffiasm zqfield-bn254;
};
rapidsnark-gpu = callPackage ./rapidsnark-gpu/default.nix {
inherit ffiasm zqfield-bn254;
};

# Elrond / MultiversX
# copied from https://github.com/NixOS/nixpkgs/blob/8df7949791250b580220eb266e72e77211bedad9/pkgs/development/python-modules/cryptography/default.nix
Expand Down Expand Up @@ -229,7 +232,7 @@
}
// lib.optionalAttrs (hostPlatform.isx86 && hostPlatform.isLinux) rec {
pistache = callPackage ./pistache/default.nix { };
inherit zqfield-bn254;
inherit zqfield-bn254 rapidsnark-gpu;
rapidsnark-server = callPackage ./rapidsnark-server/default.nix {
inherit
ffiasm
Expand Down
56 changes: 56 additions & 0 deletions packages/rapidsnark-gpu/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
lib,
cudaPackages,
stdenv,
ffiasm,
zqfield-bn254,
nlohmann_json,
gmp,
libsodium,
cmake,
fetchFromGitHub,
pkg-config,
}:
let
ffiasm-c = "${ffiasm}/lib/node_modules/ffiasm/c";
in
stdenv.mkDerivation rec {
pname = "rapidsnark-gpu";
version = "2023-04-08";

src = fetchFromGitHub {
owner = "Orbiter-Finance";
repo = "rapidsnark";
rev = "77016322808ac58a3acd25a6235510b55172f967";
hash = "sha256-8vy+iXkSINFregve+rej1rXyXdWxm0n1wvYfoy/0idk=";
};

nativeBuildInputs = [ pkg-config ];
buildInputs = [
nlohmann_json
gmp
libsodium
cudaPackages.cudatoolkit
] ++ ffiasm.passthru.openmp;

buildPhase = ''
mkdir -p $out/bin
c++ \
-I{${ffiasm-c},${zqfield-bn254}/lib} \
./src/{main_prover,binfile_utils,zkey_utils,wtns_utils,logger}.cpp \
${ffiasm-c}/{alt_bn128,misc,naf,splitparstr}.cpp \
${zqfield-bn254}/lib/{fq,fr}.{cpp,o} \
$(pkg-config --cflags --libs libsodium gmp nlohmann_json) \
-std=c++17 -pthread -O3 -fopenmp \
-o $out/bin/prover
'';

installPhase = ''
# Already done in buildPhase
'';

meta = {
homepage = "https://github.com/iden3/rapidsnark";
platforms = with lib.platforms; linux ++ darwin;
};
}