Merge pull request #170 from Anderssorby/acs/nix-build

Add nix build
main
Dan Shields 2021-05-03 16:49:46 -06:00 committed by GitHub
commit 467927bda0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 44 additions and 1 deletions

2
.envrc 100644
View File

@ -0,0 +1,2 @@
use_nix
eval "$(lorri direnv)"

3
.gitignore vendored
View File

@ -11,3 +11,6 @@
# The cache for chain data in container # The cache for chain data in container
.local .local
# direnv cache
.direnv

View File

@ -9,6 +9,11 @@ A fresh FRAME-based [Substrate](https://www.substrate.io/) node, ready for hacki
Follow the steps below to get started with the Node Template, or get it up and running right from your browser Follow the steps below to get started with the Node Template, or get it up and running right from your browser
in just a few clicks using [Playground](https://playground.substrate.dev/) :hammer_and_wrench: in just a few clicks using [Playground](https://playground.substrate.dev/) :hammer_and_wrench:
### Using Nix
Install [nix](https://nixos.org/) and optionally [direnv](https://github.com/direnv/direnv) and [lorri](https://github.com/target/lorri) for a fully plug
and play experience for setting up the development environment. To get all the correct dependencies activate direnv `direnv allow` and lorri `lorri shell`.
### Rust Setup ### Rust Setup
First, complete the [basic Rust setup instructions](./doc/rust-setup.md). First, complete the [basic Rust setup instructions](./doc/rust-setup.md).

33
shell.nix 100644
View File

@ -0,0 +1,33 @@
let
mozillaOverlay =
import (builtins.fetchGit {
url = "https://github.com/mozilla/nixpkgs-mozilla.git";
rev = "57c8084c7ef41366993909c20491e359bbb90f54";
});
pinned = builtins.fetchGit {
# Descriptive name to make the store path easier to identify
name = "nixos-unstable-2020-04-26";
url = "https://github.com/nixos/nixpkgs/";
# Commit hash for nixos-unstable as of 2020-04-26
# `git ls-remote https://github.com/nixos/nixpkgs nixos-unstable`
ref = "refs/heads/nixos-unstable";
rev = "1fe6ed37fd9beb92afe90671c0c2a662a03463dd";
};
nixpkgs = import pinned { overlays = [ mozillaOverlay ]; };
rust-nightly = with nixpkgs; ((rustChannelOf { date = "2021-03-01"; channel = "nightly"; }).rust.override {
targets = [ "wasm32-unknown-unknown" ];
});
in
with nixpkgs; pkgs.mkShell {
buildInputs = [
clang
pkg-config
rust-nightly
] ++ stdenv.lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.Security
];
LIBCLANG_PATH = "${llvmPackages.libclang}/lib";
PROTOC = "${protobuf}/bin/protoc";
ROCKSDB_LIB_DIR = "${rocksdb}/lib";
}