forked from makeecat/Peng
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from HSL-UCSC/flake
Flake
- Loading branch information
Showing
3 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,4 @@ Cargo.lock | |
*.DS_Store | ||
.idea/workspace.xml | ||
.idea/vcs.xml | ||
.cargo |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
''; | ||
}; | ||
}); | ||
} | ||
|