From 1747d02e3baa44bd2aec28b7bf8c7447ddaf3905 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Christiansen=20S=C3=B8rby?= Date: Mon, 19 Apr 2021 13:55:10 +0200 Subject: [PATCH] Add README documentation --- README.md | 5 +++++ nix/default.nix | 32 ++++++++++++++++---------------- nix/sources.json | 12 ++++++++++++ 3 files changed, 33 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index e3d466a..24faa68 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,11 @@ A fresh FRAME-based [Substrate](https://www.substrate.io/) node, ready for hacki Follow these steps to get started with the Node Template :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 First, complete the [basic Rust setup instructions](./doc/rust-setup.md). diff --git a/nix/default.nix b/nix/default.nix index 4e50702..08c911a 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -7,7 +7,7 @@ let # gitignore.nix gitignoreSource = (import sources."gitignore.nix" { inherit (pkgs) lib; }).gitignoreSource; - # pre-commit-hooks = (import sources."pre-commit-hooks.nix"); + pre-commit-hooks = (import sources."pre-commit-hooks.nix"); rust = (import ./rust.nix { inherit sources; }); @@ -17,26 +17,26 @@ in inherit pkgs src; # provided by shell.nix - devTools = with pkgs; [ + devTools = with pkgs; with pre-commit-hooks; [ niv wasm-pack wasmtime valgrind protobuf clang llvm rocksdb - # inherit (pre-commit-hooks) pre-commit nixpkgs-fmt nix-linter; + pre-commit nixpkgs-fmt nix-linter rust ]; # to be built by github actions ci = { - # pre-commit-check = pre-commit-hooks.run { - # inherit src; - # hooks = { - # shellcheck.enable = true; - # nixpkgs-fmt.enable = true; - # nix-linter.enable = true; - # # cargo-check.enable = true; - # # rustfmt.enable = true; - # # clippy.enable = true; - # }; - # # generated files - # excludes = [ "^nix/sources\.nix$" ]; - # }; + pre-commit-check = pre-commit-hooks.run { + inherit src; + hooks = { + shellcheck.enable = true; + nixpkgs-fmt.enable = true; + nix-linter.enable = true; + cargo-check.enable = true; + rustfmt.enable = true; + clippy.enable = true; + }; + # generated files + excludes = [ "^nix/sources\.nix$" ]; + }; }; } diff --git a/nix/sources.json b/nix/sources.json index 4f861ec..b3e8f0b 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -34,5 +34,17 @@ "type": "tarball", "url": "https://github.com/mozilla/nixpkgs-mozilla/archive/8c007b60731c07dd7a052cce508de3bb1ae849b4.tar.gz", "url_template": "https://github.com///archive/.tar.gz" + }, + "pre-commit-hooks.nix": { + "branch": "master", + "description": "Seamless integration of https://pre-commit.com git hooks with Nix.", + "homepage": "", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "2d169bb1b23f3b71a894a66ea81f45c788943248", + "sha256": "1iyvi56rzszwizq0ymf1x262yhjwzk8k77qahb65fcync99jha2a", + "type": "tarball", + "url": "https://github.com/cachix/pre-commit-hooks.nix/archive/2d169bb1b23f3b71a894a66ea81f45c788943248.tar.gz", + "url_template": "https://github.com///archive/.tar.gz" } }