Skip to content

Commit

Permalink
Add a nix-based build environment
Browse files Browse the repository at this point in the history
While experimenting with the repository, I've found that it's hard to
build. The list of dependencies is implicit and it takes time to
actually get the stuff compiled and run properly.

I'm not sure if anyone else would use this, but since we took time
to freeze the dependencies, I'm still submitting the result as a
pull-request, at least so that it can be used as a reference.
  • Loading branch information
knazarov committed Sep 29, 2023
1 parent 58a6b40 commit a278a23
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 0 deletions.
26 changes: 26 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

83 changes: 83 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
description = "Solana state proof";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
};

outputs = { self, nixpkgs }:
let
revCount = self.revCount or 1;
package_version = "0.1.0-${toString revCount}";

# Systems supported
allSystems = [
"x86_64-linux" # 64-bit Intel/AMD Linux
"aarch64-linux" # 64-bit ARM Linux
"x86_64-darwin" # 64-bit Intel macOS
"aarch64-darwin" # 64-bit ARM macOS
];

forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f {
pkgs = import nixpkgs { inherit system; };
});


make_package = pkgs: with pkgs;
let
stdenv = pkgs.llvmPackages_15.stdenv;

pythonEnv = python3.withPackages (ps: with ps; [ sphinx pydata-sphinx-theme ]);
in
stdenv.mkDerivation {
name = "solana_state_proof";
src = self;
dontFixCmake = true;
env.CXXFLAGS = toString([
"-fPIC"
]);
env.NIX_CFLAGS_COMPILE = toString([
"-Wno-unused-but-set-variable"
]);
nativeBuildInputs = [
cmake
fmt_8
protobuf
c-ares
boost177
ragel
gnutls
lz4
pkg-config
yaml-cpp
lksctp-tools
hwloc
numactl
libxfs
libsystemtap
linuxPackages.perf
gdb
];
cmakeFlags = [
"-DCMAKE_BUILD_TYPE=Debug"
"-DBUILD_SHARED_LIBS=FALSE"
"-DBUILD_TESTS=TRUE"
"-DBUILD_WITH_NUMA=FALSE"
"-DBUILD_WITH_CUDA=FALSE"
"-DBUILD_WITH_OPENCL=FALSE"
"-DBUILD_WITH_SANITIZE=FALSE"
"-DBUILD_WITH_DPDK=FALSE"
"-DCRYPTO3_HASH_POSEIDON=FALSE"
"-DBUILD_EXAMPLES=TRUE"
"-DZK_PLACEHOLDER_PROFILING=TRUE"
"-DBLUEPRINT_PLACEHOLDER_PROOF_GEN=True"
];
};
in
{
packages = forAllSystems({ pkgs }: {
solana_state_proof = make_package pkgs;
default = make_package pkgs;
});
};
}

0 comments on commit a278a23

Please sign in to comment.