Updated Nix build environment for working with Nimbus
Other changes: * For the macOS builds in Travis, attempt to install rocksdb through brew
This commit is contained in:
parent
822c6e0a7d
commit
14a1b51981
|
@ -15,7 +15,8 @@ matrix:
|
||||||
|
|
||||||
- os: osx
|
- os: osx
|
||||||
before_install:
|
before_install:
|
||||||
# - brew update
|
- brew update
|
||||||
|
- brew install rocksdb
|
||||||
# - brew install gcc
|
# - brew install gcc
|
||||||
|
|
||||||
- git clone https://github.com/nim-lang/nim.git
|
- git clone https://github.com/nim-lang/nim.git
|
||||||
|
|
16
README.md
16
README.md
|
@ -15,8 +15,24 @@ Join the Status community chats:
|
||||||
|
|
||||||
## Building & Testing
|
## Building & Testing
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
|
||||||
|
Please install a recent version of Facebook's RocksDB following the instructions here:
|
||||||
|
|
||||||
|
https://github.com/facebook/rocksdb/blob/master/INSTALL.md
|
||||||
|
|
||||||
Currently Nimbus requires the latest development version of the Nim programming language. Follow the [installation steps](https://github.com/nim-lang/Nim) or use [choosenim](https://github.com/dom96/choosenim).
|
Currently Nimbus requires the latest development version of the Nim programming language. Follow the [installation steps](https://github.com/nim-lang/Nim) or use [choosenim](https://github.com/dom96/choosenim).
|
||||||
|
|
||||||
|
### Obtaining the prerequisites through the Nix package manager
|
||||||
|
|
||||||
|
Users of the [Nix package manager](https://nixos.org/nix/download.html) can install all prerequisites simply by running:
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
nix-shell nimbus.nix
|
||||||
|
```
|
||||||
|
|
||||||
|
### Build
|
||||||
|
|
||||||
You can build the package and run the tests using `nimble test`. You can run the example using `nim compile --run examples/decompile_smart_contract.nim`.
|
You can build the package and run the tests using `nimble test`. You can run the example using `nim compile --run examples/decompile_smart_contract.nim`.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
22
default.nix
22
default.nix
|
@ -1,22 +1,10 @@
|
||||||
{ pkgs ? import <nixpkgs> {} }:
|
|
||||||
|
|
||||||
let
|
let
|
||||||
stdenv = pkgs.stdenv;
|
pkgs = import (builtins.fetchGit {
|
||||||
|
url = git://github.com/NixOS/nixpkgs;
|
||||||
|
rev = "8c6f9223d02c5123cbd364d6d56caca3c81416f0";
|
||||||
|
}) {};
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
import ./nimbus.nix { inherit pkgs; }
|
||||||
name = "nimbus-${version}";
|
|
||||||
version = "0.0.1";
|
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
|
||||||
description = "An Ethereum 2.0 Sharding Client for Resource-Restricted Devices";
|
|
||||||
homepage = https://github.com/status-im/nimbus;
|
|
||||||
license = [licenses.asl20];
|
|
||||||
platforms = platforms.unix;
|
|
||||||
};
|
|
||||||
|
|
||||||
src = ./.;
|
|
||||||
buildInputs = [pkgs.clang pkgs.nim pkgs.rocksdb pkgs.secp256k1 pkgs.cryptopp];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
10
devenv.nix
10
devenv.nix
|
@ -1,10 +0,0 @@
|
||||||
let
|
|
||||||
pkgs = import (builtins.fetchGit {
|
|
||||||
url = git://github.com/NixOS/nixpkgs;
|
|
||||||
rev = "8c6f9223d02c5123cbd364d6d56caca3c81416f0";
|
|
||||||
}) {};
|
|
||||||
|
|
||||||
in
|
|
||||||
|
|
||||||
import ./default.nix { inherit pkgs; }
|
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
{ stdenv, lib, makeWrapper, nodejs, openssl, pcre, readline, sqlite, nim }:
|
||||||
|
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
# This derivation may be a bit confusing at first, because it builds the Status'
|
||||||
|
# Nimbus branch of Nim using the standard Nim compiler provided by Nix.
|
||||||
|
#
|
||||||
|
# It's mostly a copy of the original Nim recipe, but uses git to obtain the
|
||||||
|
# sources and have a simplified `buildPhase`.
|
||||||
|
#
|
||||||
|
# For maintainance, you only need to bump the obtained git revision from time
|
||||||
|
# to time.
|
||||||
|
|
||||||
|
name = "status-nim";
|
||||||
|
version = "0.18.1";
|
||||||
|
|
||||||
|
src = fetchGit {
|
||||||
|
url = "git://github.com/status-im/Nim";
|
||||||
|
ref = "nimbus";
|
||||||
|
|
||||||
|
# Set this to the hash of the head commit in the nimbus branch:
|
||||||
|
rev = "d40fb5a6d3ed937d41fd0e72a27df8c397aae881";
|
||||||
|
};
|
||||||
|
|
||||||
|
doCheck = true;
|
||||||
|
|
||||||
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
NIX_LDFLAGS = [
|
||||||
|
"-lcrypto"
|
||||||
|
"-lpcre"
|
||||||
|
"-lreadline"
|
||||||
|
"-lsqlite3"
|
||||||
|
];
|
||||||
|
|
||||||
|
# 1. nodejs is only needed for tests
|
||||||
|
# 2. we could create a separate derivation for the "written in c" version of nim
|
||||||
|
# used for bootstrapping, but koch insists on moving the nim compiler around
|
||||||
|
# as part of building it, so it cannot be read-only
|
||||||
|
|
||||||
|
buildInputs = [
|
||||||
|
makeWrapper nodejs nim
|
||||||
|
openssl pcre readline sqlite
|
||||||
|
];
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
nim c --lib:"./lib" -d:release koch.nim
|
||||||
|
nim c --lib:"./lib" -d:release compiler/nim.nim && mv compiler/nim bin/
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
install -Dt $out/bin bin/* koch
|
||||||
|
./koch install $out
|
||||||
|
mv $out/nim/bin/* $out/bin/ && rmdir $out/nim/bin
|
||||||
|
mv $out/nim/* $out/ && rmdir $out/nim
|
||||||
|
wrapProgram $out/bin/nim \
|
||||||
|
--suffix PATH : ${lib.makeBinPath [ stdenv.cc ]}
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = with stdenv.lib; {
|
||||||
|
description = "Status's build of Nim";
|
||||||
|
homepage = https://nim-lang.org/;
|
||||||
|
license = licenses.mit;
|
||||||
|
maintainers = with maintainers; [ ehmry peterhoeg ];
|
||||||
|
platforms = with platforms; linux ++ darwin; # arbitrary
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
{ pkgs ? import <nixpkgs> { } }:
|
||||||
|
|
||||||
|
let
|
||||||
|
stdenv = pkgs.stdenv;
|
||||||
|
nim = pkgs.callPackage ./nim.nix {};
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
name = "nimbus-${version}";
|
||||||
|
version = "0.0.1";
|
||||||
|
|
||||||
|
meta = with stdenv.lib; {
|
||||||
|
description = "An Ethereum 2.0 Sharding Client for Resource-Restricted Devices";
|
||||||
|
homepage = https://github.com/status-im/nimbus;
|
||||||
|
license = [licenses.asl20];
|
||||||
|
platforms = platforms.unix;
|
||||||
|
};
|
||||||
|
|
||||||
|
src = ./.;
|
||||||
|
buildInputs = [pkgs.clang nim pkgs.rocksdb_lite];
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue