Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ rls*.log
scripts/ci/node-template-release/Cargo.lock
bin/node-template/Cargo.lock
substrate.code-workspace
.direnv/
/.envrc
1 change: 1 addition & 0 deletions bin/node-template/.envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
6 changes: 4 additions & 2 deletions bin/node-template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,10 @@ Instead of installing dependencies and building this source directly, consider t

### Nix

Install [nix](https://nixos.org/), and optionally [direnv](https://github.com/direnv/direnv) and [lorri](https://github.com/nix-community/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`.
Install [nix](https://nixos.org/) and
[nix-direnv](https://github.com/nix-community/nix-direnv) for a fully plug-and-play
experience for setting up the development environment.
To get all the correct dependencies, activate direnv `direnv allow`.

### Docker

Expand Down
43 changes: 43 additions & 0 deletions bin/node-template/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions bin/node-template/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils, ... }: flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
in
{
devShells.default = pkgs.mkShell {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

devenv can be used here. it also generates Codespace on demand and more sembles home-manager/nixos config. but this is good too.

Copy link
Contributor Author

@farcaller farcaller Mar 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thanks! wrong comment

I'll look into it in the next PR if that's alright. I want to add the buildable into the flake as well and it's a bit tricky to do right with a sandbox right now.

packages = with pkgs; [
rustup
clang
protobuf
rustfmt
];

LIBCLANG_PATH = "${pkgs.libclang.lib}/lib";
};
});
}
14 changes: 14 additions & 0 deletions bin/node-template/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[toolchain]
channel = "nightly"
components = [
"cargo",
"clippy",
"rust-analyzer",
"rust-src",
"rust-std",
"rustc-dev",
"rustc",
"rustfmt",
]
targets = [ "wasm32-unknown-unknown" ]
profile = "minimal"
35 changes: 0 additions & 35 deletions bin/node-template/shell.nix

This file was deleted.

43 changes: 43 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils, ... }: flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
in
{
devShells.default = pkgs.mkShell {
packages = with pkgs; [
rustup
clang
protobuf
gnumake
rustfmt
];

LIBCLANG_PATH = "${pkgs.libclang.lib}/lib";
};
});
}
14 changes: 14 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[toolchain]
channel = "nightly"
components = [
"cargo",
"clippy",
"rust-analyzer",
"rust-src",
"rust-std",
"rustc-dev",
"rustc",
"rustfmt",
]
targets = [ "wasm32-unknown-unknown" ]
profile = "minimal"