Skip to content

Instantly share code, notes, and snippets.

@Yash-Garg
Created July 19, 2025 14:23
Show Gist options
  • Save Yash-Garg/f3008c3ae6488bf21347c8961b64c617 to your computer and use it in GitHub Desktop.
Save Yash-Garg/f3008c3ae6488bf21347c8961b64c617 to your computer and use it in GitHub Desktop.
Rust with Nix on MacOS
{
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs =
{ flake-utils, nixpkgs, ... }:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
with pkgs;
{
devShells.default = mkShell {
buildInputs = [ rustup ];
RUSTC_VERSION = lib.readFile ./rust-toolchain.toml;
shellHook = ''
export PATH=$PATH:''${CARGO_HOME:-~/.cargo}/bin
export PATH=$PATH:''${RUSTUP_HOME:-~/.rustup}/toolchains/$RUSTC_VERSION-x86_64-apple-darwin/bin/
'';
};
}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment