-
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.
Adds a Rust environment with necessary tooling like `cargo`, `rustc`, and linkers, and recommended tooling like `clippy` and `rustfmt`. --------- Co-authored-by: Rok Garbas <rok@flox.dev>
- Loading branch information
Showing
9 changed files
with
102 additions
and
2 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
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 @@ | ||
{"name":"rust","version":1} |
Large diffs are not rendered by default.
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,51 @@ | ||
version = 1 | ||
|
||
[install] | ||
# Rust toolchain, put them in the same package group | ||
# so rustc/cargo/etc exactly match versions/dependencies. | ||
cargo.pkg-path = "cargo" | ||
cargo.pkg-group = "rust-toolchain" | ||
rustc.pkg-path = "rustc" | ||
rustc.pkg-group = "rust-toolchain" | ||
clippy.pkg-path = "clippy" | ||
clippy.pkg-group = "rust-toolchain" | ||
rustfmt.pkg-path = "rustfmt" | ||
rustfmt.pkg-group = "rust-toolchain" | ||
rust-lib-src.pkg-path = "rustPlatform.rustLibSrc" | ||
rust-lib-src.pkg-group = "rust-toolchain" | ||
|
||
# rust-analyzer goes in its own group because it's updated | ||
# on a different cadence from the compiler and doesn't need | ||
# to match versions | ||
rust-analyzer.pkg-path = "rust-analyzer" | ||
rust-analyzer.pkg-group = "rust-analyzer" | ||
|
||
# Linkers | ||
clang.pkg-path = "clang" | ||
clang.systems = ["aarch64-darwin", "x86_64-darwin"] | ||
gcc.pkg-path = "gcc" | ||
gcc.systems = ["aarch64-linux", "x86_64-linux"] | ||
|
||
# Platform-specific libraries | ||
libiconv.pkg-path = "libiconv" | ||
libiconv.systems = ["aarch64-darwin", "x86_64-darwin"] | ||
|
||
# Extra tools | ||
cargo-nextest.pkg-path = "cargo-nextest" | ||
cargo-watch.pkg-path = "cargo-watch" | ||
cargo-semver-checks.pkg-path = "cargo-semver-checks" | ||
# For more use search: flox search cargo- --all | ||
|
||
[vars] | ||
|
||
[hook] | ||
|
||
[profile] | ||
|
||
[options] | ||
systems = [ | ||
"aarch64-darwin", | ||
"x86_64-darwin", | ||
"aarch64-linux", | ||
"x86_64-linux", | ||
] |
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 @@ | ||
/target |
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,6 @@ | ||
[package] | ||
name = "rust" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] |
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,3 @@ | ||
fn main() { | ||
println!("Hello, world!"); | ||
} |
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,30 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eo pipefail | ||
|
||
check_command() { | ||
if ! command -v $1 2>&1 >/dev/null | ||
then | ||
echo "Error: '$1' command could not be found." | ||
exit 1 | ||
fi | ||
} | ||
|
||
check_command rustc | ||
check_command rustfmt | ||
check_command cargo | ||
check_command cargo-fmt | ||
check_command cargo-clippy | ||
|
||
|
||
cargo fmt | ||
echo ">>> Formatting code" | ||
|
||
cargo clippy | ||
echo ">>> Linting code" | ||
|
||
cargo run | ||
echo ">>> Building and running code" | ||
|
||
cargo test | ||
echo ">>> Testing code" |