Skip to content

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.

  1. Fork coredev-uk/sona-go and clone your fork, or clone it directly if you can push branches.

  2. 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/main
    cd ../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).

Run one command in the toolchain:

Terminal window
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:

Terminal window
nix run github:NixOS/nixpkgs/nixpkgs-unstable#devenv -- shell

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.

Most work needs no account. For live checks (playspike, the live tests), put your Music User Token in .env, which git ignores:

Terminal window
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.