Skip to content

Commit

Permalink
add a flake file for development environment
Browse files Browse the repository at this point in the history
  • Loading branch information
friend0 committed Nov 10, 2024
1 parent 51c1efd commit 2a163e5
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 0 deletions.
60 changes: 60 additions & 0 deletions flake.lock

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

35 changes: 35 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
description = "Rust development environment with Cargo dependencies";

# Specify the inputs, such as nixpkgs
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

# Define the outputs
outputs = { self, nixpkgs, flake-utils }: flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs { inherit system; };
in {
# Define a devShell for development
devShell = pkgs.mkShell {
# Add Rust and Cargo to the environment
buildInputs = [
pkgs.rustup
];

# Optionally, set environment variables
CARGO_HOME = "./.cargo";
RUST_BACKTRACE = "1"; # Enable backtrace for debugging

# Optional shellHook to fetch dependencies when entering the shell
shellHook = ''
echo "Entering Rust development environment..."
rustup default nightly
cargo install rerun-cli
cargo fetch # Pre-fetch dependencies defined in Cargo.toml
'';
};
});
}

0 comments on commit 2a163e5

Please sign in to comment.