-
Notifications
You must be signed in to change notification settings - Fork 3
Nix Flake Cleanup #272
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
base: main
Are you sure you want to change the base?
Nix Flake Cleanup #272
Changes from 6 commits
fa2d8e9
35bcf1e
6a7f6a5
43329a7
19e9d75
9da4660
882ebb2
77b8171
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,4 +30,7 @@ site/* | |
| Zone.Identifier | ||
|
|
||
| #Vector Lock File | ||
| can/dbc/**/*.ldb | ||
| can/dbc/**/*.ldb | ||
|
|
||
| # Arduino-cli files | ||
| .arduino* | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,51 @@ | ||||||||||||||||||||||
| #!/usr/bin/env bash | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Exit on error | ||||||||||||||||||||||
| set -e | ||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using |
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Get the directory where this script is located | ||||||||||||||||||||||
| SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # --- Python Setup --- | ||||||||||||||||||||||
| export PIP_DISABLE_PIP_VERSION_CHECK=1 | ||||||||||||||||||||||
| VENV_PATH="$SCRIPT_DIR/.venv" | ||||||||||||||||||||||
| REQ_PATH="$SCRIPT_DIR/requirements.txt" | ||||||||||||||||||||||
| SENTINEL="$VENV_PATH/.pip_installed" | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| if [ ! -d "$VENV_PATH" ]; then | ||||||||||||||||||||||
| echo "Creating virtual environment..." | ||||||||||||||||||||||
| python3 -m venv "$VENV_PATH" | ||||||||||||||||||||||
| fi | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| source "$VENV_PATH/bin/activate" | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| if [ -f "$REQ_PATH" ]; then | ||||||||||||||||||||||
| # Only install if the sentinel doesn't exist OR requirements.txt is newer than the sentinel | ||||||||||||||||||||||
| if [ ! -f "$SENTINEL" ] || [ "$REQ_PATH" -nt "$SENTINEL" ]; then | ||||||||||||||||||||||
| echo "Updating python requirements..." | ||||||||||||||||||||||
| if pip install -q -r "$REQ_PATH"; then | ||||||||||||||||||||||
| touch "$SENTINEL" | ||||||||||||||||||||||
| else | ||||||||||||||||||||||
| echo "Error: pip install failed." | ||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||||||||||||||||
| fi | ||||||||||||||||||||||
| fi | ||||||||||||||||||||||
| fi | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # --- Arduino Setup --- | ||||||||||||||||||||||
| # Isolate Arduino data to the project folder | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| if ! arduino-cli core list | grep -q "esp32" > /dev/null; then | ||||||||||||||||||||||
| echo "Installing ESP32 core..." | ||||||||||||||||||||||
| arduino-cli core update-index > /dev/null | ||||||||||||||||||||||
| arduino-cli core install esp32:esp32 > /dev/null | ||||||||||||||||||||||
| fi | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # --- Helpers --- | ||||||||||||||||||||||
| if [[ "$OSTYPE" == "darwin"* ]]; then | ||||||||||||||||||||||
| lsusb_mac() { system_profiler SPUSBDataType; } | ||||||||||||||||||||||
| export -f lsusb_mac | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ls_stm32_dev_port() { ls /dev/cu.*; } | ||||||||||||||||||||||
| export -f ls_stm32_dev_port | ||||||||||||||||||||||
|
Comment on lines
+67
to
+71
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The ESP32 core installation command is currently commented out, but the check and the 'Installing...' message are active. This causes the script to print the installation message every time the shell is entered without actually performing the installation. Either uncomment the installation command or remove this block to avoid the redundant message loop.
Suggested change
|
||||||||||||||||||||||
| fi | ||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modifying file permissions with
chmod +xinside ashellHookis unnecessary and can fail on read-only filesystems (e.g., in certain CI environments or Nix builds). It is better to ensure the script is committed with executable permissions in the repository.