Set Up Your Environment
Everything runs through devenv, which pins Go, GStreamer and the system libraries Sona links. You need Nix and devenv 2.4 or newer on Linux, or on a Mac with Apple silicon.
Get the code
Section titled “Get the code”-
Fork coredev-uk/sona-go and clone your fork, or clone it directly if you can push branches.
-
Keep that checkout on
main. Give every change its own worktree and branch, named<type>/<slug>after its Conventional Commit type:Terminal window git worktree add ../sona-go-queue-autoplay -b feat/queue-autoplay origin/maincd ../sona-go-queue-autoplay
Git hooks refuse commits and pushes on main. Worktrees keep parallel changes apart, and each one needs its own private runtime state (see Build and Run).
Enter the environment
Section titled “Enter the environment”Run one command in the toolchain:
devenv shell -- <command>Or open an interactive shell with devenv shell. The first run downloads the toolchain. The shell sets CGO_ENABLED=1, GOFLAGS=-tags=sqlite_fts5 and the GStreamer paths, and loads .env.
Without devenv installed, run it through Nix:
nix run github:NixOS/nixpkgs/nixpkgs-unstable#devenv -- shellLoad it automatically with direnv
Section titled “Load it automatically with direnv”With direnv, the checked-in .envrc loads the same environment when you cd into a checkout or worktree. Run direnv allow once in each. After that go, dev, check and the other scripts work without the devenv shell -- prefix.
Add your token
Section titled “Add your token”Most work needs no account. For live checks (playspike, the live tests), put your Music User Token in .env, which git ignores:
MUSIC_USER_TOKEN=...A new worktree has no .env. Symlink the one from your main checkout only when you need a live token.
Never print, log or commit .env or a token. SONA_LASTFM_KEY, SONA_LASTFM_SECRET and SONA_DISCORD_CLIENT_ID can live there too; development builds read them at run time.
Next steps
Section titled “Next steps”- Build and Run your change.
- Test Your Change before you open a pull request.
- Full reference, including every devenv script: docs/development.md.