https://github.com/ergoplatform/ergo-nix
https://github.com/ergoplatform/ergo-nix
Last synced: 6 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/ergoplatform/ergo-nix
- Owner: ergoplatform
- Created: 2020-11-22T12:35:20.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-07-19T05:46:41.000Z (almost 3 years ago)
- Last Synced: 2023-04-19T17:17:25.810Z (about 2 years ago)
- Language: Nix
- Size: 92.8 KB
- Stars: 3
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-ergo - Ergo Nix Toolkit
README
# Ergo Nix Toolkit
This repository provides Nix derivations for packages and services of [the Ergo ecosystem](https://ergoplatform.org/en/).
Key Features •
Installation •
Usage### [Why Nix?](https://nixos.org/guides/nix-pills/why-you-should-give-it-a-try.html)
There are many existing systems for software configuration and most of them are far more user friendly than Nix. However, I feel like Nix is the best available tool to build immutable and pure (as in functional programming) *Infrastructure as a Code*, which is so important in the FinTech world.
The way Nix calculates whether a derivation input has changed is by taking its cryptographic hash. Dependencies are recursive, so this hash is actually a hash of hashes — a powerful concept instantly recognizable to blockchain enthusiasts. If any of the inputs change, so does the result and therefore we end up with a totally different software package.
## Key Features
### Packages
* `ergo-node`
* provides the Ergo blockchain nodes
* `ergo-explorer-backend`
* provides Ergo explorer backend tooling (chain-grabber, explorer-api and utx-{watcher,broadcaster})
* `ergo-explorer-frontend`
* provides the Ergo explorer web interface
### Services
* `services.ergo-node`## Installation
If you are not running NixOS, you need to at least install [Nix](https://nixos.org/download.html)
```bash
$ curl -L https://nixos.org/nix/install | sh
```After installing Nix, add the following to `/etc/nix/nix.conf` to take advantage of the cache, so you do not have to rebuild everything. After adding it, you need to restart the `nix-daemon` service.
```
substituters = https://cache.nixos.org https://ergo-nix.cachix.org
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= ergo-nix.cachix.org-1:5T2FPh0TfxXqrMYAwf/VGDycBW6Dy/W/L6I3DFhc1iQ=
```If you are using NixOS, you probably know how to add these as your binary caches.
## Usage
### Software Packages
You can add it as a channel.
```bash
$ nix-channel --add https://github.com/ergoplatform/ergo-nix/archive/master.tar.gz ergo-nix
$ nix-channel --update
unpacking channels...
``````bash
$ nix-env -iA ergo-nix.ergo-node
installing 'ergo-node-3.3.6'
```Or you can just use it directly as a Nix path.
```bash
$ nix-env -iA ergo-node -f https://github.com/ergoplatform/ergo-nix/archive/master.tar.gz
unpacking 'https://github.com/ergoplatform/ergo-nix/archive/master.tar.gz'...
installing 'ergo-node-3.3.6'
```### Software services
It is also possible to directly use the NixOS services, that will take care of the configuration.
```nix
{ config, pkgs, lib, ... }:
let# Import the Ergo Nix toolkit repository
ergo-nix = builtins.fetchTarball {
url = "https://github.com/ergoplatform/ergo-nix/archive/6a5f1da142f6cb292623967b48b43b84d5f8ebff.tar.gz";
sha256 = "0dkrzy6hp1b1xd307klgmi02s0g2yqic5jxl1m08vmbg4g86l4x6";
};in {
# Import the Ergo nix services from the repository above
imports = (import "${ergo-nix}/nixos");# Enable the Ergo node service
services.ergo-node.enable = true;
}
```