-
Notifications
You must be signed in to change notification settings - Fork 22
feat: nix flake #1383
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
Merged
Merged
feat: nix flake #1383
Changes from all commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
c790cc3
simple nix flake
2946921
relocate flake
e8fd772
use version from workspace
4766bc2
flake compiles
c9c7d35
remove openssl as it gets built in
d24f2d3
get git rev working correctly
b2329bf
add wrapped bb because c++
e6d684f
update bad refs
0ba1906
allow unfree so that steam run works
79dc310
remove result
69355ff
automate nix build
4a5c15b
update docs
db00f30
update release script comments
96bb13f
add tag to docs
edbc4be
add information on commit hash
492bad5
Merge branch 'main' into ry/nix-flake
ryardley 2b255ca
fix up code rabbit
e00749d
Update flake.nix
ryardley 1487dd5
remove template
86fb004
update pnpm
7f84a8c
Merge branch 'main' into ry/nix-flake
ryardley e76e7e3
add check nix flake to CI to avoid commits not being installable
bf541df
Merge branch 'main' into ry/nix-flake
ryardley 37eac72
fix bad actions command
68b180e
update name
e14a1c8
update docs to be more concice
4cb13f3
Update installation.mdx
ryardley 2503c86
add flake.nix and flake.lock so that we can use nix in docker
9cc15cc
Merge branch 'main' into ry/nix-flake
ryardley b344417
update nix flake to be driven from versions,json
58a0f3a
Merge branch 'main' into ry/nix-flake
cedoor f7d8e90
Merge branch 'main' into ry/nix-flake
cedoor 75d8b13
Merge branch 'main' into ry/nix-flake
ryardley 7c6ea30
add cachix
d42fb90
add note about cachix
faa7852
attempt to fix mac build error
24a8b7b
Merge branch 'main' into ry/nix-flake
ryardley ca9ee6b
Merge branch 'main' into ry/nix-flake
ryardley 2d8554d
Merge branch 'main' into ry/nix-flake
ryardley e472420
Merge branch 'main' into ry/nix-flake
cedoor 4fdfa91
Merge branch 'main' into ry/nix-flake
ryardley 4d26142
Merge branch 'main' into ry/nix-flake
ryardley 2ef524e
Merge branch 'main' into ry/nix-flake
ryardley d9ab1a6
Merge branch 'main' into ry/nix-flake
ryardley d4a487f
Merge branch 'main' into ry/nix-flake
ctrlc03 db01ecf
Merge branch 'main' into ry/nix-flake
cedoor ac0f9fb
chore: update barretenberg download url
cedoor d6b2824
Merge branch 'main' into ry/nix-flake
ryardley b0f9820
comment out other versions
d94739b
Merge branch 'main' into ry/nix-flake
ryardley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,180 @@ | ||
| { | ||
| description = "Enclave"; | ||
| nixConfig = { | ||
| extra-substituters = ["https://enclave.cachix.org"]; | ||
| extra-trusted-public-keys = ["enclave.cachix.org-1:B5SynR85iX/TRueDpZu4dh1xVR8lNfKoAaVWZkux1ss="]; | ||
| }; | ||
| inputs = { | ||
| nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
| flake-utils.url = "github:numtide/flake-utils"; | ||
| }; | ||
| outputs = { | ||
| self, | ||
| nixpkgs, | ||
| flake-utils, | ||
| }: let | ||
| # define the version hashes. everytime we change dependencies these need to change | ||
| noirHash = "sha256-RoeWaqgFwr8A4HAlu5DzuxrNrexMolIZG14fHQA0KmM="; | ||
| fheHash = "sha256-dS8LcKDI/D9ycsRXbQnMVkUc2ymFBFL8kDrEtRGuHNI="; | ||
| vfsHash = "sha256-+d8RFk7UgOXDCE/LizCTV+UX/Xm/1mYWrR7W0l6mAl8="; | ||
| # bb version + checksums driven from versions.json | ||
| versionsJson = builtins.fromJSON (builtins.readFile ./crates/zk-prover/versions.json); | ||
| bbVersion = versionsJson.required_bb_version; | ||
| bbHashes = versionsJson.bb_checksums; | ||
| in | ||
| flake-utils.lib.eachDefaultSystem (system: let | ||
| pkgs = import nixpkgs { | ||
| inherit system; | ||
| config.allowUnfree = true; | ||
| }; | ||
| noirSrc = pkgs.fetchFromGitHub { | ||
| owner = "noir-lang"; | ||
| repo = "noir"; | ||
| rev = "v1.0.0-beta.16"; | ||
| hash = noirHash; | ||
| }; | ||
| bbPlatform = | ||
| if pkgs.stdenv.isLinux | ||
| then | ||
| if pkgs.stdenv.isAarch64 | ||
| then "arm64-linux" | ||
| else "amd64-linux" | ||
| else if pkgs.stdenv.isDarwin | ||
| then | ||
| if pkgs.stdenv.isAarch64 | ||
| then "arm64-darwin" | ||
| else "amd64-darwin" | ||
| else throw "Unsupported platform"; | ||
| bbBin = pkgs.stdenv.mkDerivation { | ||
| pname = "barretenberg"; | ||
| version = bbVersion; | ||
| src = pkgs.fetchurl { | ||
| url = "https://github.com/gnosisguild/aztec-packages/releases/download/v${bbVersion}/barretenberg-${bbPlatform}.tar.gz"; | ||
| sha256 = bbHashes.${bbPlatform}; | ||
| }; | ||
| nativeBuildInputs = pkgs.lib.optionals pkgs.stdenv.isLinux [pkgs.autoPatchelfHook]; | ||
| buildInputs = pkgs.lib.optionals pkgs.stdenv.isLinux [pkgs.stdenv.cc.cc.lib]; | ||
| sourceRoot = "."; | ||
| installPhase = '' | ||
| mkdir -p $out/bin | ||
| install -D -m755 bb $out/bin/bb | ||
| ''; | ||
| meta = { | ||
| description = "Barretenberg proving system"; | ||
| homepage = "https://github.com/AztecProtocol/aztec-packages"; | ||
| }; | ||
| }; | ||
| bb = | ||
| if pkgs.stdenv.isLinux | ||
| then | ||
| pkgs.buildFHSEnv { | ||
| name = "bb"; | ||
| targetPkgs = p: [bbBin p.stdenv.cc.cc.lib]; | ||
| runScript = "${bbBin}/bin/bb"; | ||
| } | ||
| else bbBin; | ||
| wrapped-bb = | ||
| if pkgs.stdenv.isLinux | ||
| then | ||
| pkgs.writeShellScriptBin "bb" '' | ||
| exec ${pkgs.steam-run}/bin/steam-run ${bb}/bin/bb "$@" | ||
| '' | ||
| else bb; | ||
| e3-cli = pkgs.rustPlatform.buildRustPackage { | ||
| pname = "e3-cli"; | ||
| version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).workspace.package.version; | ||
| src = ./.; | ||
| GIT_SHA = self.rev or self.dirtyRev or "unknown"; | ||
| GIT_COMMIT = "unknown"; | ||
| GIT_DIRTY = "false"; | ||
| preBuild = '' | ||
| for d in $(find /build -type d -name 'noirc_driver*'); do | ||
| if [ -d "$d/src" ]; then | ||
| cp -r ${noirSrc}/noir_stdlib "$d/../../noir_stdlib" | ||
| fi | ||
| done | ||
| export HOME=$(mktemp -d) | ||
| git config --global user.email "nix@nix" | ||
| git config --global user.name "nix" | ||
| git init | ||
| git add -A | ||
| git commit -m "nix build" --allow-empty | ||
| ''; | ||
| cargoLock = { | ||
| lockFile = ./Cargo.lock; | ||
| outputHashes = builtins.listToAttrs ( | ||
| map (name: { | ||
| inherit name; | ||
| value = noirHash; | ||
| }) [ | ||
| "acir-1.0.0-beta.16" | ||
| "acir_field-1.0.0-beta.16" | ||
| "acvm-1.0.0-beta.16" | ||
| "acvm_blackbox_solver-1.0.0-beta.16" | ||
| "bn254_blackbox_solver-1.0.0-beta.16" | ||
| "brillig-1.0.0-beta.16" | ||
| "brillig_vm-1.0.0-beta.16" | ||
| "fm-1.0.0-beta.16" | ||
| "iter-extended-1.0.0-beta.16" | ||
| "nargo-1.0.0-beta.16" | ||
| "noir_greybox_fuzzer-1.0.0-beta.16" | ||
| "noir_protobuf-1.0.0-beta.16" | ||
| "noirc_abi-1.0.0-beta.16" | ||
| "noirc_arena-1.0.0-beta.16" | ||
| "noirc_artifacts-1.0.0-beta.16" | ||
| "noirc_driver-1.0.0-beta.16" | ||
| "noirc_errors-1.0.0-beta.16" | ||
| "noirc_evaluator-1.0.0-beta.16" | ||
| "noirc_frontend-1.0.0-beta.16" | ||
| "noirc_printable_type-1.0.0-beta.16" | ||
| "noirc_span-1.0.0-beta.16" | ||
| ] | ||
| ++ map (name: { | ||
| inherit name; | ||
| value = fheHash; | ||
| }) [ | ||
| "fhe-0.1.0-beta.7" | ||
| "fhe-math-0.1.0-beta.7" | ||
| "fhe-traits-0.1.0-beta.7" | ||
| "fhe-util-0.1.0-beta.7" | ||
| ] | ||
| ++ map (name: { | ||
| inherit name; | ||
| value = vfsHash; | ||
| }) [ | ||
| "vfs-0.12.1" | ||
| ] | ||
| ); | ||
| }; | ||
| buildAndTestSubdir = "crates/cli"; | ||
| nativeBuildInputs = [ | ||
| pkgs.pkg-config | ||
| pkgs.git | ||
| pkgs.pnpm | ||
| pkgs.nodejs | ||
| pkgs.jq | ||
| pkgs.solc | ||
| ]; | ||
| buildInputs = [ | ||
| pkgs.openssl | ||
| ]; | ||
| meta = { | ||
| description = "e3 CLI"; | ||
| license = pkgs.lib.licenses.lgpl3Only; | ||
| }; | ||
|
ryardley marked this conversation as resolved.
|
||
| }; | ||
| in { | ||
| packages.default = e3-cli; | ||
| packages.cli = e3-cli; | ||
| packages.bb = wrapped-bb; | ||
| devShells.default = pkgs.mkShell { | ||
| packages = [ | ||
| e3-cli | ||
| wrapped-bb | ||
| ]; | ||
| shellHook = '' | ||
| export E3_CUSTOM_BB="${wrapped-bb}/bin/bb" | ||
| ''; | ||
| }; | ||
| }); | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.