Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Rust environment #3

Merged
merged 5 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
| |
| **Languages:** |
| `python-poetry` | ✅ | ✅ | ✅ | |
| `rust` | ✅ | ✅ | ✅ | Rust environment |
| **Databases:** |
| `postgres` | ✅ | ✅ | ✅ | |
| `redis` | ✅ | ✅ | ✅ | |
Expand All @@ -21,8 +22,7 @@
| `qmk` | ✅ | ✅ | ✅ | Open-source keyboard firmware for Atmel AVR and Arm USB families |
| `anthropic` | | | | |
| `direnv` | | | | |
| `flaim` | | | | |
| `flaim` | ✅ | ✅ | | A stack of Python modules for Stable Diffusion |
| `flaim` | ✅ | ✅ | ✅ | A stack of Python modules for Stable Diffusion |
| `fooocus` | | | | |
| `metabase` | | | | |
| `ollama` | | | | |
Expand Down
1 change: 1 addition & 0 deletions rust/.flox/env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"rust","version":1}
1 change: 1 addition & 0 deletions rust/.flox/env/manifest.lock

Large diffs are not rendered by default.

51 changes: 51 additions & 0 deletions rust/.flox/env/manifest.toml
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",
]
1 change: 1 addition & 0 deletions rust/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
7 changes: 7 additions & 0 deletions rust/Cargo.lock

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

6 changes: 6 additions & 0 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[package]
name = "rust"
version = "0.1.0"
edition = "2021"

[dependencies]
3 changes: 3 additions & 0 deletions rust/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}
30 changes: 30 additions & 0 deletions rust/test.sh
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"
Loading