Skip to content
Open
Changes from all 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
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,48 @@ A `rustc` and `cargo` that can build for the Rust target `sbf-solana-solana`
## `anchor`

The full Anchor CLI, including a functional build toolchain for the `anchor build` command.

## Usage

Define your `flake.nix` like the one below. It will install other necessary dependencies like

- Nodejs and yarn
- rustup with stable toolchain

```nix
{
description = "Solana and anchor flake";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
solana.url = "github:arilotter/solana-flake";
};

outputs = { self, nixpkgs, rust-overlay, solana }:
let
pkgs = import nixpkgs {
overlays = [ rust-overlay.overlays.default ];
system = "x86_64-linux";
};
in
{
devShells.x86_64-linux.default = pkgs.mkShell {
buildInputs = [
pkgs.rustup
solana.packages.x86_64-linux.default
pkgs.nodejs_22
pkgs.yarn
];

shellHook = ''
# Install the stable toolchain and set it as default
if ! rustup show | grep -q 'stable'; then
rustup install stable
rustup default stable
fi
'';
};
};
}
```