# GitHub Actions Runner (`github_runner`) Ephemeral, Nix-enabled self-hosted GitHub Actions runner built on `myoung34/github-runner:ubuntu-noble` with Nix (`nix-command` and `flakes` enabled) and GitHub App authentication. ## Architecture - **Host-Mode Execution (No Docker Socket)**: Canopy forbids mounting `/var/run/docker.sock` or running privileged containers. Workflows run directly inside the runner container as the non-root `runner` user (`RUN_AS_ROOT=false`). - **Ephemeral Lifecycle (`EPHEMERAL=true`)**: After completing a single job, the runner deregisters and exits `0`; Docker (`restart: unless-stopped`) restarts the container and `entrypoint-nix.sh` re-authenticates via the GitHub App for a clean runner instance. - **Persistent State & Nix Cache**: - Runner work directory: `../../var/lib/homelab/github_runner:/data` (`RUNNER_WORKDIR=/data/work`). - Nix store cache: named Docker volume `nix-store:/nix` so evaluated derivations persist across ephemeral restarts. If `/nix/var/nix/profiles/default/bin/nix` is missing or broken, `entrypoint-nix.sh` seeds `/nix` from `/opt/nix-seed.tar.gz` and ensures `runner:runner` ownership. - **Network Isolation**: Intentionally **not** attached to `proxy-net`; uses the default isolated Compose bridge for outbound HTTPS to GitHub only. ## GitHub App Permissions Create and install a dedicated GitHub App on your organization (for **private** repositories): - **Organization permissions**: `Self-hosted runners: Read and write` - **Repository permissions**: `Metadata: Read-only` ## Configuration See [`.env-example`](.env-example) for required runtime variables (stored in gitignored `.env`, `chmod 0640`): - `GITHUB_RUNNER_SCOPE`: `org` (default) or `repo` - `GITHUB_RUNNER_ORG_NAME`: Target GitHub organization slug (when `org`) - `GITHUB_RUNNER_APP_ID`: GitHub App ID - `GITHUB_RUNNER_APP_LOGIN`: GitHub App slug/login - `GITHUB_RUNNER_APP_PRIVATE_KEY_B64`: Single-line base64-encoded PEM (`base64 -w0 < key.pem`), decoded at container startup into `APP_PRIVATE_KEY` for pure-Python `.env` compatibility. - `GITHUB_RUNNER_LABELS`: Comma-separated runner labels (default `self-hosted,linux,x64,nix`).