Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Update the nix build configuration. (#13706)
Browse files Browse the repository at this point in the history
* Update the nix build configuration.

Remove the old shell.nix with some legacy versions pinned and replace it with a flake-based shell. It installs rust via rustup instead of fenix to be more generally compatible with the guidelines.

This also adds the rust-toolchain.toml spec with all the components required for wasm, and everything else to make rust-analyzer & clippy happy.

* Also add the top level flake for hacking on the substrate as whole

* Remove the envrc and ignore it instead.

* Remove the top-level configuration

---------

Co-authored-by: parity-processbot <>
  • Loading branch information
farcaller authored May 20, 2023
1 parent 0046337 commit 2000147
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 37 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ rls*.log
*.iml
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.

22 changes: 22 additions & 0 deletions bin/node-template/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
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
];

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.

0 comments on commit 2000147

Please sign in to comment.