nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib, stdenv, fetchFromGitHub, cmake, boost, gmp, openssl, pkg-config }:
2
3stdenv.mkDerivation rec {
4 pname = "libff";
5 version = "0.2.1";
6
7 src = fetchFromGitHub {
8 owner = "scipr-lab";
9 repo = "libff";
10 rev = "v${version}";
11 sha256 = "0dczi829497vqlmn6n4fgi89bc2h9f13gx30av5z2h6ikik7crgn";
12 fetchSubmodules = true;
13 };
14
15 cmakeFlags = [ "-DWITH_PROCPS=Off" ]
16 ++ lib.optional stdenv.isAarch64 [ "-DCURVE=ALT_BN128" "-DUSE_ASM=OFF" ];
17
18 # CMake is hardcoded to always build static library which causes linker
19 # failure for Haskell applications depending on haskellPackages.hevm on macOS.
20 postPatch = lib.optionalString stdenv.isDarwin ''
21 substituteInPlace libff/CMakeLists.txt --replace "STATIC" "SHARED"
22 '';
23
24 nativeBuildInputs = [ cmake pkg-config ];
25 buildInputs = [ boost gmp openssl ];
26
27 meta = with lib; {
28 description = "C++ library for Finite Fields and Elliptic Curves";
29 changelog = "https://github.com/scipr-lab/libff/blob/develop/CHANGELOG.md";
30 homepage = "https://github.com/scipr-lab/libff";
31 license = licenses.mit;
32 platforms = platforms.unix;
33 maintainers = with maintainers; [ arturcygan ];
34 };
35}