First Project¶
A flake built by Gradient, with the outputs in a binary cache.
Requirements:
- A running instance. Setup options: Quick Start or Standalone
- A flake inside a Git repository that the server can access
1. First User¶
The first superuser can come only from declarative state. Registration is off by default. Accounts from registration never become superusers.
install -d -m 700 /var/lib/gradient-secrets
gradient hash > /var/lib/gradient-secrets/admin-password # (1)!
- Password prompt twice, then an argon2id hash as output. The CLI page lists the install steps.
services.gradient.state.users.admin = {
email = "admin@example.com";
password_file = "/var/lib/gradient-secrets/admin-password"; # (1)!
superuser = true;
};
- The file contains the hash, not the password. A plaintext password in it would make the server fail on start.
Sign in as admin with the password. Registration can stay off. Other user options are in Declarative State.
Set services.gradient.registration.enable = true to allow more users to sign up through https://gradient.example.com/account/register. Registration requests fail with oidc.required on. Only superusers can create projects by default with local workers enabled. Set services.gradient.permissions.createProject = "everyone" to let registered users create projects.
2. Create a Cache¶
Go to Caches -> Create Cache. Choose a name and set the visibility.
A cache holds all build outputs of the project. nix treats the cache as a substituter and can pull those outputs from it.
3. Create a Project¶
Open Projects -> Create Project and set up a new project. Then go to Settings -> Cache Subscriptions -> Add Cache and select the cache created in step 2.
A project acts as the access boundary. All members, workers and caches live inside one project. Open Settings -> Workers -> Grant Team after the subscription. Select team server and click Grant. Find the local worker under Settings -> Workers within about 1 minute.
4. Create a Task¶
A task combines one repository with the flake outputs to build from it.
Open the project page and select Connect repository. Fill in the two fields below. Click Continue to move through the steps, then click Create task.
| Field | Value |
|---|---|
| Repository URL | Git URL of the flake, e.g. https://github.com/wavelens/gradient |
| Evaluation Wildcard | Flake outputs to build, e.g. packages.x86_64-linux.*, see wildcards |
Private Repositories
Each project ships with an SSH key, listed under Settings -> SSH Key. Add the public key as a deploy key on the Git host to access private repositories.
Gradient can trust the host key of the Git server on the first SSH fetch for a project. Gradient can store that key per project. The server and all workers accept only that key on later fetches. Gradient can stop the fetch with a "host key changed" error when the fetched key and the saved key differ. Open Settings -> Host Keys for Git to check the fingerprint. Click Check New Key to trust the new key. Gradient doesn't read the known_hosts file.
5. Start an Evaluation¶
Press Run on the task page to start the latest commit. Gradient can scan the flake and identify every derivation that matches the wildcard. All those builds go to workers.
Verify Deployment¶
- The evaluation page lists all builds with live logs, sorted by status.
- Completed builds show the status
completedand store their outputs in the cache.
Next Steps¶
- Evaluation wildcards: choose which outputs to build
- Connect GitHub: run evaluations on every push and pull request
- Share a Cache: reuse the cache across other machines
- Add a Remote Worker: attach extra build machines