Skip to content

gnosisguild/e3-nix-flake

Repository files navigation

UPDATE this will likely be supereeded by this gnosisguild/enclave#1383

Enclave Nix Flake

If you have nix and direnv installed:

nix flake init -t github:gnosisguild/e3-nix-flake && direnv allow

Verify installation:

enclave --version 
bb --version
echo $E3_CUSTOM_BB # /nix/store/.../bb

Cloud Setup

Tested with Digital Ocean Ubuntu 24.05.

1. Install Nix (as root)

curl -fsSL https://raw.githubusercontent.com/gnosisguild/e3-nix-flake/refs/heads/master/install-nix.sh | bash

Exit and SSH back in to load the environment.

2. Create User

adduser --disabled-password --gecos "" myuser
sudo -iu myuser

3. Install Direnv (as user)

curl -fsSL https://raw.githubusercontent.com/gnosisguild/e3-nix-flake/refs/heads/master/install-direnv.sh | bash
source ~/.bashrc

4. Initialize Project

Make a project folder then setup your project environment:

mkdir enclave && cd enclave

Initialize your git repo - optional but recommended to save your dependency configuration as you add other dependencies and tools

git init

Initialize the folder with a basic ./flake.nix demonstrating how to use enclave.

nix flake init -t github:gnosisguild/e3-nix-flake

Run direnv allow

direnv allow

Upgrading Enclave

To upgrade enclave simply add the new version number to your ./flake.nix

{
  description = "New e3 project";
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    flake-utils.url = "github:numtide/flake-utils";
    e3.url = "github:gnosisguild/e3-nix-flake";
    e3.inputs.nixpkgs.follows = "nixpkgs";
  };
  outputs = {
    self,
    nixpkgs,
    flake-utils,
    e3,
    ...
  }:
    flake-utils.lib.eachDefaultSystem (system: let
      pkgs = nixpkgs.legacyPackages.${system};
      e3p = e3.packages.${system}."0.1.14"; # to upgrade change this version
    in {
      devShells.default = pkgs.mkShell {
        packages = with pkgs; [
          e3p.bb
          e3p.enclave
          pkg-config
          openssl_3_6
          # Add any extra packages you need here from nixos.org
          # neovim git wget curl etc.. 
        ];
        shellHook = ''
          export OPENSSL_DIR="${pkgs.openssl_3_6.dev}"
          export OPENSSL_LIB_DIR="${pkgs.openssl_3_6.out}/lib"
          export OPENSSL_INCLUDE_DIR="${pkgs.openssl_3_6.dev}/include"
          export E3_CUSTOM_BB="${e3p.bb}/bin/bb"
        '';
      };
    });
}

Then run direnv allow to refresh dependencies. Barretenberg updates automatically.

References

About

Flake for enclave

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors