Skip to content

Commit

Permalink
Merge pull request #3 from HSL-UCSC/flake
Browse files Browse the repository at this point in the history
Flake
  • Loading branch information
friend0 authored Nov 10, 2024
2 parents 51c1efd + b4e0bda commit 5e69d97
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ Cargo.lock
*.DS_Store
.idea/workspace.xml
.idea/vcs.xml
.cargo
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 5e69d97

Please sign in to comment.