Skip to content

Commit

Permalink
update nix to flake
Browse files Browse the repository at this point in the history
  • Loading branch information
alxiong committed Nov 19, 2022
1 parent cf49741 commit 7e72676
Show file tree
Hide file tree
Showing 21 changed files with 267 additions and 357 deletions.
14 changes: 5 additions & 9 deletions arithmetic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,16 @@
name = "arithmetic"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]

ark-bls12-381 = { version = "0.3.0", default-features = false, features = [ "curve" ] }
ark-ff = { version = "^0.3.0", default-features = false }
ark-std = { version = "^0.3.0", default-features = false }
ark-poly = { version = "^0.3.0", default-features = false }
ark-serialize = { version = "^0.3.0", default-features = false }
ark-bls12-381 = { version = "0.3.0", default-features = false, features = [ "curve" ] }

rand_chacha = { version = "0.3.0", default-features = false }
ark-std = { version = "^0.3.0", default-features = false }
displaydoc = { version = "0.2.3", default-features = false }
rand_chacha = { version = "0.3.0", default-features = false }
rayon = { version = "1.5.2", default-features = false, optional = true }

[dev-dependencies]
Expand All @@ -23,7 +20,7 @@ criterion = "0.3.0"

[features]
# default = [ "parallel", "print-trace" ]
default = [ "parallel" ]
default = ["parallel"]
parallel = [
"rayon",
"ark-std/parallel",
Expand All @@ -34,8 +31,7 @@ print-trace = [
"ark-std/print-trace"
]


[[bench]]
name = "mle_eval"
path = "benches/bench.rs"
harness = false
harness = false
148 changes: 148 additions & 0 deletions flake.lock

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

84 changes: 84 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
description = "Hyperplonk dev env";

inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils"; # for dedup

# allow shell.nix alongside flake.nix
inputs.flake-compat.url = "github:edolstra/flake-compat";
inputs.flake-compat.flake = false;

inputs.rust-overlay.url = "github:oxalica/rust-overlay";
inputs.pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
inputs.pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";

outputs = { self, nixpkgs, flake-utils, flake-compat, rust-overlay, pre-commit-hooks, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
nightlyToolchain = pkgs.rust-bin.selectLatestNightlyWith
(toolchain: toolchain.minimal.override { extensions = [ "rustfmt" ]; });

stableToolchain = pkgs.rust-bin.stable.latest.minimal.override {
extensions = [ "clippy" "llvm-tools-preview" "rust-src" ];
};
in with pkgs;
{
check = {
pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
check-format = {
enable = true;
files = "\\.rs$";
entry = "cargo fmt -- --check";
};
doctest = {
enable = true;
entry = "cargo test --doc";
files = "\\.rs$";
pass_filenames = false;
};
cargo-clippy = {
enable = true;
description = "Lint Rust code.";
entry = "cargo-clippy --workspace -- -D warnings";
files = "\\.rs$";
pass_filenames = false;
};
cargo-sort = {
enable = true;
description = "Ensure Cargo.toml are sorted";
entry = "cargo sort -w";
pass_filenames = false;
};
};
};
};
devShell = mkShell {
buildInputs = [
argbash
openssl
pkgconfig
git

stableToolchain
nightlyToolchain
cargo-sort

] ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ];

shellHook = ''
export RUST_BACKTRACE=full
export PATH="$PATH:$(pwd)/target/debug:$(pwd)/target/release"
# Ensure `cargo fmt` uses `rustfmt` from nightly.
export RUSTFMT="${nightlyToolchain}/bin/rustfmt"
''
# install pre-commit hooks
+ self.check.${system}.pre-commit-check.shellHook;
};
}
);
}
17 changes: 6 additions & 11 deletions hyperplonk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,21 @@
name = "hyperplonk"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]

ark-std = { version = "^0.3.0", default-features = false }
arithmetic = { path = "../arithmetic" }
ark-ec = { version = "^0.3.0", default-features = false }
ark-ff = { version = "^0.3.0", default-features = false }
ark-poly = { version = "^0.3.0", default-features = false }
ark-serialize = { version = "^0.3.0", default-features = false, features = [ "derive" ] }

ark-std = { version = "^0.3.0", default-features = false }
displaydoc = { version = "0.2.3", default-features = false }

rayon = { version = "1.5.2", default-features = false, optional = true }
subroutines = { path = "../subroutines" }
transcript = { path = "../transcript" }
arithmetic = { path = "../arithmetic" }
util = { path = "../util" }

rayon = { version = "1.5.2", default-features = false, optional = true }

[dev-dependencies]
ark-bls12-381 = { version = "0.3.0", default-features = false, features = [ "curve" ] }

Expand All @@ -35,8 +30,8 @@ harness = false
# default = [ ]
# default = [ "parallel" ]
# default = [ "parallel", "print-trace" ]
default = [ "parallel", "extensive_sanity_checks" ]
bench = [ "parallel" ]
default = ["parallel", "extensive_sanity_checks"]
bench = ["parallel"]
# extensive sanity checks that are useful for debugging
extensive_sanity_checks = [
"subroutines/extensive_sanity_checks",
Expand All @@ -56,4 +51,4 @@ print-trace = [
"ark-std/print-trace",
"arithmetic/print-trace",
"subroutines/print-trace"
]
]
28 changes: 0 additions & 28 deletions nix/grcov/default.nix

This file was deleted.

25 changes: 0 additions & 25 deletions nix/nightly.nix

This file was deleted.

4 changes: 0 additions & 4 deletions nix/nixpkgs.json

This file was deleted.

10 changes: 0 additions & 10 deletions nix/nixpkgs.nix

This file was deleted.

Loading

0 comments on commit 7e72676

Please sign in to comment.