mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 18:18:55 +00:00
Some recent changes to the Rust part of the codebase made it quite difficult to locally build the project due to tauri's heavy dependencies on WebKitGTK and other native libraries. I tried working around this on my local (nix) machine and found it quite difficult. The cleanest way here is to make use of what Nix calls "devshells" which give you an environment specifically for hacking on your project. Unfortunately, these files need to be tracked in version control and cannot be ignored (at least I've not found a way to do that). Given that we already have a lot of clutter in our repository, I put them under `scripts/nix`. They are generally useful. I also added a `.envrc` file which automatically launches the dev-shell. As a result, you have a shell ready to go with all your dependencies as soon as you `cd` into our repository (assuming you use `direnv` and it is hooked up with your shell). I didn't really want to have any of my local setup leak into the repo because I think apart from me and @conectado, nobody is using nix, thus I hope this minimal footprint is an okay compromise.
Firezone shell scripts
This directory contains various shell scripts used for development, testing, and deployment of the Firezone product.
Developer Setup
We lint shell scripts in CI. To get your PR to pass, you'll want to ensure your local development environment is set up to lint shell scripts:
- Install
shfmt:brew install shfmton macOS- Install shfmt from https://github.com/mvdan/sh/releases for other platforms
- Install
shellcheck:brew install shellcheckon macOSsudo apt-get install shellcheckon Ubuntu
Then just lint and format your shell scripts before you commit:
shfmt -i 4 **/*.sh
shellcheck --severity=warning **/*.sh
You can achieve this more easily by using pre-commit. See
CONTRIBUTING.
Editor setup
- Vim (here's an example using ALE)
- VSCode
Scripting tips
- Use
#!/usr/bin/env bashalong withset -euo pipefailin general for dev and test scripts. - In Docker images and other minimal envs, stick to
#!/bin/shand simplyset -eu.