Skip to content

Instantly share code, notes, and snippets.

@TomMD
Last active February 16, 2026 23:40
Show Gist options
  • Select an option

  • Save TomMD/c74f0fa2c3f33a38526e5aab5b4f6de6 to your computer and use it in GitHub Desktop.

Select an option

Save TomMD/c74f0fa2c3f33a38526e5aab5b4f6de6 to your computer and use it in GitHub Desktop.
Solana on Nix shell.nix
with import <nixpkgs> {};
let agave = (builtins.getFlake "github:tommd/nixpkgs?ref=add-agave-forked-derivation").legacyPackages.${pkgs.system}.solana-agave;
platformTools = (builtins.getFlake "github:tommd/platform-tools?rev=79b7b43775d15cacb04a434fcb111a56bbb9b16a").packages.${pkgs.system}.default;
in mkShell {
# Packages provided as build inputs
buildInputs = [
agave
platformTools
openssl
gcc
];
# pkg-config needs to be in nativeBuildInputs for the shell hooks to work correctly
nativeBuildInputs = [
pkg-config
];
# Optional: set environment variables if the build system needs hints (e.g., Rust projects)
shellHook = ''
export PKG_CONFIG_PATH=${openssl.dev}/lib/pkgconfig:$PKG_CONFIG_PATH
export PATH=${platformTools}/rust/bin:$PATH
echo "Consider: cargo build-sbf --skip-tools-install --no-rustup-override"
'';
}
@TomMD
Copy link
Author

TomMD commented Feb 16, 2026

With this nix-shell script downloaded as shell.nix you can:

$ nix-shell
$ which cargo-build-sbf
/nix/store/qkhfash9cw3x25xwfkh912q1mrs427i5-solana-agave-2.3.12/bin/cargo-build-sbf
$ cargo build-sbf --skip-tools-install --no-rustup-override

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment