Add GitHub Actions runner configuration to nix-builder
Co-authored-by: Jyumpp <11142390+Jyumpp@users.noreply.github.com>
This commit is contained in:
@@ -125,6 +125,37 @@ CI jobs run on the `nix-builder` host as a self-hosted GitHub Actions runner. Th
|
||||
- Consistent build environment matching deployment targets
|
||||
- Direct access to build caching infrastructure
|
||||
|
||||
#### Setting Up the GitHub Actions Runner
|
||||
|
||||
The nix-builder host is configured with a GitHub Actions self-hosted runner in `inventory.nix`. To complete the setup:
|
||||
|
||||
1. **Generate a GitHub Personal Access Token (PAT)**:
|
||||
- Go to https://github.com/settings/tokens
|
||||
- Create a new token with `repo` scope
|
||||
- Copy the token value
|
||||
|
||||
2. **Create the token file on nix-builder**:
|
||||
```bash
|
||||
ssh engr-ugaif@nix-builder
|
||||
echo "YOUR_TOKEN_HERE" | sudo tee /var/lib/github-runner-token > /dev/null
|
||||
sudo chmod 600 /var/lib/github-runner-token
|
||||
```
|
||||
|
||||
3. **Rebuild the system** to start the runner:
|
||||
```bash
|
||||
sudo nixos-rebuild switch --flake github:UGA-Innovation-Factory/nixos-systems#nix-builder
|
||||
```
|
||||
|
||||
4. **Verify the runner is registered**:
|
||||
- Check https://github.com/UGA-Innovation-Factory/nixos-systems/settings/actions/runners
|
||||
- The runner should appear with the `nix-builder` label
|
||||
|
||||
The runner service is configured in the nix-builder device configuration and will automatically:
|
||||
- Register with the repository on first start
|
||||
- Use the `nix-builder` label for workflow targeting
|
||||
- Run as the `engr-ugaif` user
|
||||
- Store work in `/var/lib/github-runner`
|
||||
|
||||
### Troubleshooting CI Failures
|
||||
|
||||
If CI fails:
|
||||
|
||||
@@ -96,7 +96,26 @@
|
||||
# Creates: nix-builder (without lxc prefix)
|
||||
nix-lxc = {
|
||||
devices = {
|
||||
"nix-builder" = { };
|
||||
"nix-builder" = {
|
||||
# GitHub Actions self-hosted runner configuration
|
||||
# The runner will register itself with the repository on first start
|
||||
services.github-runners.nixos-systems = {
|
||||
enable = true;
|
||||
url = "https://github.com/UGA-Innovation-Factory/nixos-systems";
|
||||
# Token file must be created manually at this path with a GitHub PAT
|
||||
# that has repo access. Generate at: https://github.com/settings/tokens
|
||||
# echo "YOUR_TOKEN_HERE" | sudo tee /var/lib/github-runner-token > /dev/null
|
||||
tokenFile = "/var/lib/github-runner-token";
|
||||
# Labels to identify this runner in workflows
|
||||
extraLabels = [ "nix-builder" ];
|
||||
# User to run the runner as
|
||||
user = "engr-ugaif";
|
||||
# Working directory for runner
|
||||
workDir = "/var/lib/github-runner";
|
||||
# Replace runner on config changes
|
||||
replace = true;
|
||||
};
|
||||
};
|
||||
"usda-dash" = builtins.fetchGit {
|
||||
url = "https://git.factory.uga.edu/MODEL/usda-dash-config.git";
|
||||
rev = "c47ab8fe295ba38cf3baa8670812b23a09fb4d53";
|
||||
|
||||
Reference in New Issue
Block a user