Scripts
autocomplete.sh
For what this script actually does, run echo $(mk-workspace-shell-setup), but it pretty much does what it says in the .envrc file (shown everytime you enter direnv - whenever you go into the perseus repo), setting up autocomplete for ROS and python.
clean.sh
This script will be run from the command nix run .#clean and shouldn't need to be modified. That said, it removes any built, installed, or generated files and basically resets the repo back to when it was first installed.
machine-setup.sh
This script is designed to be run on the big-brain to setup any config that the nix home manager can't do itself. Currently, the script:
- Sets the default shell to be z-shell (to give us autocomplete)
- Sets up nix files to be accessible only by sudo (for security purposes)
- Creates network rule files (can't create these without sudo, but home-manager can edit them without sudo)
- Sets the CAN network send buffer length to be 128 (there was a buffer issue when running E&C)
member-setup.sh
This script should be run whenever installing the repo on a fresh device. It installs required packages (direnv, git, gh), clones the repo, runs nix-setup.sh, builds the nix packages, and restarts the shell. It is designed to be run by the command:
curl https://raw.githubusercontent.com/ROAR-QUTRC/perseus-v2/refs/heads/main/software/scripts/member-setup.sh | bash
Which gets the raw content of the .sh file and executes it by piping it directly into bash.
nix-packages.sh
This script should be run whenever the ROS2 package dependencies (any package.xml files in the ros_ws folder) have been changed. It updates the nix packaging with the new dependencies and automatically commits the changes using git (use the --no-commit flag to not do this)
nix-setup.sh
This script should be run on every device that wants to run the perseus repo (members, big-brain, medium-brain, etc). Currently, the script:
- Installs Nix package manager (see the Nix Basics page)
- Adds binary caches (and keys) to the trusted substituters so your computer can copy them instead of compiling them itself
- Disables the dirty git tree warning (which will run everytime you have local staged changes and try to build the flake)
- Adds the current user to the 'trusted-users' in the nix config, which stops the warning when running nix in a 'relaxed sandbox'.
- Adds the direnv hooks to your shell (enables direnv in your shell, so you have the environment variables needed)
- Hides the massive wall of text displaying the environment variables on startup/reload
The nix-setup script can't be run on NixOS - you'll have to set these manually in your configuration.nix file (and your home.nix home-manager file), but if you're using NixOS, you should have no trouble doing this
update.sh
This script will update the nix flake packages to their latest version and then run the formatter. It should be run frequently to ensure that the nixpkgs are up to date (you can check if it will actually update the nixpkgs by looking at the commits on the nix-ros-overlay repo here).
vcan-setup.sh
This script can be run if you need to test CAN software on your computer without booting up Perseus. It sets up a virtual CAN network, so instead of physically connecting into the CAN network like on the big-brain, you can run Perseus ROS2 scripts to make sure they work together.