Skip to content

jhvst/ethereum.nix

Repository files navigation

ethereum.nix = Ethereum + Nix 🫶

Ethereum Ecosystem Built with nix License

This is an experimental Nix project for integrating the most interesting / important projects in the Ethereum ecosystem as Nix packages / NixOS modules.

Many of the packages found here will be added to nixpkgs repository once they're stable / mature enough. But for some others, more experimental ones, they can reside here.

This project is developed entirely in Nix Flakes.

Usage

As a flake (recommended)
{
  inputs = {
    ethereum-nix = {
      url = "github:nix-community/ethereum.nix";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    nixpkgs.url = "nixpkgs/nixos-unstable";
  };

  outputs = { self, ethereum-nix, nixpkgs }: {
    nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      modules = [
        ({ pkgs, ... }: {
          nixpkgs.overlays = [ ethereum-nix.overlays.default ];
        })
      ];
    };
  };
}
As an overlay
# configuration.nix
{ pkgs, ... }: {
  nixpkgs.overlays = [
    (import "${fetchTarball "https://github.com/nix-community/ethereum.nix/archive/main.tar.gz"}/overlays.nix")
  ];
  environment.systemPackages = with pkgs; [
    teku
    lighthouse
    # <...>
  ];
}

Setup

NixOS

If you're on NixOS, chances are you know what you're doing. If you don't have installed direnv, clone this repository and when entering inside the folder, just execute nix develop. It will load a devShell environment ready to be used.

Optional: install direnv, so whenever you enter inside the directory, it will run nix develop for you automatically.

Non-NixOS

To get started, run the following:

  1. Install Nix:
$ curl -L https://nixos.org/nix/install | sh
  1. Clone this repository and when entering inside the folder, just execute nix develop. It will load a devShell environment ready to be used.

Optional: install direnv, so whenever you enter inside the directory, it will run nix develop for you automatically.

Development

Just

Nobody wants to memorize complex inputs for doing things in the terminal. For that reason, we use just as a command runner to save and run common tasks. By just writing:

just

It will describe available commands (commands are defined in it's respective Justfile, so have a look)!

Formatting

Formatting will be run via pre-commit hook if you are in the nix shell, otherwise you can manually format using the format command like so:

just fmt

Applications

Note: every command has a local and a remote variant. The local variant requires that the command is run from within the cloned repo. The remote variant can be run from wherever.

Local: nix run .#my-app-name

Remote: nix run github:nix-community/ethereum.nix#my-app-name

For brevity and consistency, all the commands are listed in the local variant

Executables provided

Consensus Clients

  • prysm:
    • beacon-chain: nix run .#prysm-beacon-chain
    • client-stats: nix run .#prysm-client-stats
    • prysmctl: nix run .#prysm-ctl
    • validator: nix run .#prysm-validator
  • teku: nix run .#teku
  • lighthouse: nix run .#lighthouse

Execution Clients

  • besu: nix run .#besu
  • erigon: nix run .#erigon
  • geth:
    • abidump: nix run .#abidump
    • abigen: nix run .#abigen
    • bootnode: nix run .#bootnode
    • clef: nix run .#clef
    • devp2p: nix run .#devp2p
    • ethkey: nix run .#ethkey
    • evm: nix run .#evm
    • faucet: nix run .#faucet
    • geth: nix run .#geth
    • rlpdump: nix run .#rlpdump
  • mev-geth: nix run .#mev-geth
  • mev-boost: nix run .#mev-boost

Utilities / Tools / Other

Libraries

Some crypto projects may need specific libraries to be available to compile properly. Below you can find the list of included ones:

Libraries provided

Contribute

We welcome any kind of contribution or support to this project but before to do so:

  • Make sure you have read the contribution guide for more details on how to submit a good PR (pull request).

In addition you can always:

Acknowledgements

This project has been inspired by the awesome work of:

  • cosmos.nix by Informal Systems which this repository takes inspiration on it's README and several other places.

  • willruggiano on his work done in eth-nix repository that served as the initial kick-start for working on this project.

About

Nix packages and NixOS modules for the Ethereum ecosystem. [maintainers=@aldoborrero,@brianmcgee,@selfuryon]

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Nix 99.4%
  • Shell 0.6%