Skip to content

Configuration

The services.gradient NixOS module exposes one option per setting. The definitions come from nix/modules. Each option maps to a CLI flag and an environment variable with the same name.

  • upload.bytesBudget maps to --upload-bytes-budget and GRADIENT_UPLOAD_BYTES_BUDGET.
  • worker.build.maxConcurrent maps to --build-max-concurrent and GRADIENT_WORKER_BUILD_MAX_CONCURRENT.
  • Module-only options such as packages, reverseProxy and postgres lack an environment variable.

Declarative entities under services.gradient.state appear in the state reference.

General

Option Type Default Env Description
baseDir path "/var/lib/gradient" GRADIENT_BASE_DIR Directory holding Gradient's state, NAR files and caches.
domain string - - Domain under which Gradient is reachable.
enable bool false - Whether to enable Gradient, a Nix-CI for Teams.
environmentVariables lazy attribute set of (null or bool or int or string or path) { } - Environment variables of the Gradient server. The configuration reference lists every variable and its default. Set a variable to null to unset it. Secrets belong into secrets.
grantLocalWorkerToNewProjects bool false - Set whether all new projects receive a local worker on this host. A local worker can access the Nix store, the network, and files that belong to user gradient-worker on the server host. Default: false. Admins use that default to add a local worker to a project by granting team server with the workers flag enabled for that project.
listenAddr string "127.0.0.1" GRADIENT_LISTEN_ADDR IP address for the Gradient server to listen on.
localWorker bool worker.enable - Whether to automatically register worker on this host with an ID based on the hostname, a token from first boot and a peer file. The worker is part of team server declared in the state. Jobs for projects on that worker run on the server host and can reach the Nix store and network of that host. Administrators can allow the worker per project, or grantLocalWorkerToNewProjects can give the worker to every new project. Only superusers can create projects by default after that. See permissions.createProject.
port port 3000 GRADIENT_PORT Port for the Gradient server to listen on.
publicListing bool true GRADIENT_PUBLIC_LISTING Whether to list public projects and caches to everyone. Set this option to false for 404 from GET /api/v1/projects/public and GET /api/v1/caches/public. Search operations skip public items. These items don't have the user's membership, share, subscription, or star. Cache dashboards skip public caches. These caches don't have membership, share, or subscription. Stars, dashboards, and direct links still work for public projects, tasks, and caches.
retentionDays unsigned int 90 GRADIENT_RETENTION_DAYS Days to keep job assignment records, finished deliveries, worker connection history, webhook and task action deliveries, expired sessions and CLI logins. Finished admin tasks, the audit log, per-build resource samples and finished cluster jobs share the same limit. Removed resource samples no longer feed build predictions. Finished cluster jobs without remaining members go on the next hourly pass. Active cluster jobs and the newest finished admin task of each kind stay exempt. Open worker connections stay until the next connection of the same worker. Set it to 0 to keep every record forever.
serveUrl string derived GRADIENT_SERVE_URL Public URL of Gradient. Set this for a URL other than domain, for example behind a port mapping.
sourceCommitHash null or string null GRADIENT_SOURCE_COMMIT_HASH Git commit of the Gradient source on this server. The web interface can display this commit next to the version in the footer. The NixOS module of the Gradient flake can set this value from the flake revision. Set this value to null to show the version only.
useQuic bool false GRADIENT_USE_QUIC Whether to enable advertising HTTP/3 (QUIC) to clients.
useTls bool true GRADIENT_USE_TLS Whether to enable TLS.
yearlyRecapEnabled bool true GRADIENT_YEARLY_RECAP_ENABLED Control whether Gradient Wrapped, the yearly recap for this instance, can appear to all users. The web interface can open the current year's recap once per user between December 1 and January 10 (UTC). Users can reopen the recap from a dashboard card. Set false to hide the recap and skip creation of a new recap.
yearlyRecapPublicProjectsOnly bool false GRADIENT_YEARLY_RECAP_PUBLIC_PROJECTS_ONLY Use this option to hide names of private projects, their tasks and builds and the name of the busiest worker in Gradient Wrapped. Counts and totals still include private projects. Recaps that already exist also respect this setting.

build

Option Type Default Env Description
build.defaultMaxSilentSecs unsigned int 3600 GRADIENT_BUILD_DEFAULT_MAX_SILENT_SECS Timeout in seconds without build output for derivations without maxSilent. Set it to 0 to disable the timeout.
build.defaultTimeoutSecs unsigned int 14400 GRADIENT_BUILD_DEFAULT_TIMEOUT_SECS Build timeout in seconds for derivations without timeout. Set it to 0 to disable the timeout.
build.inputsUnavailableMaxLoops positive int 3 GRADIENT_BUILD_INPUTS_UNAVAILABLE_MAX_LOOPS Times a build can retry after missing inputs before failing instead of retrying again.
build.maxAttempts positive int 3 GRADIENT_BUILD_MAX_ATTEMPTS Build or eval job attempts before a transient failure is permanent.
build.retryBackoffSecs unsigned int 30 GRADIENT_BUILD_RETRY_BACKOFF_SECS Seconds before retrying a transient build failure, doubled for every previous attempt.
build.substituteMissEscalationThreshold positive int 2 GRADIENT_BUILD_SUBSTITUTE_MISS_ESCALATION_THRESHOLD Free re-queues of a derivation available in a cache within one evaluation, before building the derivation like any other. A re-queue does not count as a build attempt. This threshold is the only bound on that loop.

cache

Option Type Default Env Description
cache.debugIndexIntervalSecs positive int 300 GRADIENT_CACHE_DEBUG_INDEX_INTERVAL_SECS Seconds between passes of the DWARF build ID index backfill. Uploads enter the index immediately. Only paths cached before the index existed or interrupted by a restart need the pass.
cache.maxStorageGb unsigned int 0 GRADIENT_CACHE_MAX_STORAGE_GB Storage limit for NAR files for the whole instance (GB). An upload to any cache can fail when its size plus 10 MiB is more than the free space. New evaluations for all projects wait. Per-cache limits still apply. Use 0 to disable this limit.
cache.signSweepIntervalSecs positive int 3600 GRADIENT_CACHE_SIGN_SWEEP_INTERVAL_SECS Seconds between passes that sign unsigned cache entries. Uploads receive a signature at once. Only three kinds of rows need this pass. They are subscription placeholders, unsigned leftovers and published dependency outputs. The cache publishes dependency outputs every 300 seconds and on every wake.
cache.upstreamQueryConcurrency positive int 32 GRADIENT_CACHE_UPSTREAM_QUERY_CONCURRENCY Maximum simultaneous narinfo requests to upstream caches across the server.

database

Option Type Default Env Description
database.cache.maxConnections positive int 32 GRADIENT_DATABASE_CACHE_MAX_CONNECTIONS Maximum connections of the cache query pool. It is separate from the scheduler pool to keep a large evaluation's prefetch traffic from starving job assignment.
database.cache.minConnections unsigned int 2 GRADIENT_DATABASE_CACHE_MIN_CONNECTIONS Minimum connections kept open in the cache query pool.
database.maxConnections positive int 16 GRADIENT_DATABASE_MAX_CONNECTIONS Maximum connections of the scheduler and worker pool. Server processes each open up to the sum of database.maxConnections, database.cache.maxConnections and database.web.maxConnections. PostgreSQL's max_connections must accommodate that sum. The scheduler opens 2 more connections in a separate pool for refreshing waiting evaluations. max_connections must also accommodate them.
database.minConnections unsigned int 2 GRADIENT_DATABASE_MIN_CONNECTIONS Minimum connections kept open in the scheduler and worker pool.
database.url string "postgresql://gradient@localhost/gradient?host=/run/postgresql" GRADIENT_DATABASE_URL Use a connection URL for PostgreSQL without a password. Files in the Nix store are world-readable and contain the connection URL. Use database.urlFile for a URL with a password.
database.urlFile path derived GRADIENT_DATABASE_URL_FILE File containing the PostgreSQL connection URL, taking precedence over database.url.
database.web.maxConnections positive int 8 GRADIENT_DATABASE_WEB_MAX_CONNECTIONS Maximum connections of the HTTP API pool.
database.web.minConnections unsigned int 1 GRADIENT_DATABASE_WEB_MIN_CONNECTIONS Minimum connections kept open in the HTTP API pool.

email

Option Type Default Env Description
email.enable bool false GRADIENT_EMAIL_ENABLE Whether to enable sending email.
email.from.address string - GRADIENT_EMAIL_FROM_ADDRESS Sender email address.
email.from.name string "Gradient" GRADIENT_EMAIL_FROM_NAME Sender display name.
email.requireVerification bool false GRADIENT_EMAIL_REQUIRE_VERIFICATION Whether to enable email verification for new accounts.
email.smtp.host string - GRADIENT_EMAIL_SMTP_HOST SMTP server host name.
email.smtp.passwordFile path - GRADIENT_EMAIL_SMTP_PASSWORD_FILE File containing the SMTP password.
email.smtp.port port 587 GRADIENT_EMAIL_SMTP_PORT SMTP server port.
email.smtp.useTls bool true GRADIENT_EMAIL_SMTP_USE_TLS Whether to enable TLS for SMTP.
email.smtp.username string - GRADIENT_EMAIL_SMTP_USERNAME SMTP user name.

eval

Option Type Default Env Description
eval.allowedUriPrefixes list of string [ ] GRADIENT_EVAL_ALLOWED_URI_PREFIXES Allowed URL prefixes that each project evaluation can fetch, in addition to the inputs pinned by flake.lock. Under Nix setting restrict-eval, builtins.fetchTree, fetchurl and fetchTarball fail on other URLs. Prefixes also cover URLs under them. A scheme-only entry such as github: allows the whole scheme. Projects can add their own prefixes, but they can't disable the restriction.
eval.cache.maxAgeDays unsigned int 30 GRADIENT_EVAL_CACHE_MAX_AGE_DAYS Days since the last compaction after which the eval cache of a flake fingerprint leaves with all its segments, regardless of the size limit.
eval.cache.maxTotalBytes unsigned int 10737418240 GRADIENT_EVAL_CACHE_MAX_TOTAL_BYTES Total size in bytes of the shared eval caches, counted after compaction. The eval cache of a flake fingerprint leaves with all its segments, least recently compacted first, until the total is within this size.
eval.cache.sweepIntervalSecs positive int 3600 GRADIENT_EVAL_CACHE_SWEEP_INTERVAL_SECS Seconds between eval cache eviction passes.
eval.maxKeep unsigned int 30 GRADIENT_EVAL_MAX_KEEP Maximum number of evaluations kept per task. It is the cap for the per-task setting, and new tasks start at the lower of 30 and this value. Set it to 0 to disable the limit.

exec

Option Type Default Env Description
exec.enable bool true GRADIENT_EXEC_ENABLE Whether to enable exec jobs. When disabled, exec entry points fail with a message instead of starting a job.

frontend

Option Type Default Env Description
frontend.enable bool true - Whether to enable the Gradient web frontend.
frontend.logoUrl null or string null GRADIENT_FRONTEND_LOGO_URL URL of an image to display instead of the Gradient logo on the sign-in pages, in its original colors. Set it to null to keep the Gradient logo.
frontend.redirectBrowserRequestsToFrontendPages bool frontend.enable || frontend.url != serveUrl GRADIENT_FRONTEND_REDIRECT_BROWSER_REQUESTS_TO_FRONTEND_PAGES Whether requests for HTML pages at the binary cache URL redirect to the matching page in the web frontend. One example is clicking a link to a store path in the terminal. Redirects happen at the cache root, nix-cache-info, gradient-cache-info, <hash>.narinfo and ls/<hash>. Requests for an HTML page carry text/html in their Accept header. Nix, curl and API clients receive the plain response unchanged. Default off with frontend.enable disabled and frontend.url that can still point to serveUrl, because no frontend pages exist there.
frontend.url string serveUrl GRADIENT_FRONTEND_URL Public URL of the Gradient frontend, used for links in CI status reports.

gc

Option Type Default Env Description
gc.deepIntervalSecs unsigned int 3600 GRADIENT_GC_DEEP_INTERVAL_SECS Seconds from the end of one background deep garbage collection round to the start of the next. Set it to 0 to run rounds only on request.
gc.deepPaceMs unsigned int 1000 GRADIENT_GC_DEEP_PACE_MS Milliseconds between two units of a storage migration or a background deep garbage collection round. Requested rounds run their units without a pause.
gc.intervalSecs positive int 3600 GRADIENT_GC_INTERVAL_SECS Seconds between garbage collection passes.
gc.narTtlHours unsigned int 336 GRADIENT_GC_NAR_TTL_HOURS The number of hours a cache can hold claims for cached paths outside the live closure of retained evaluations. Start the count at the last fetch of that cache. Start the count at claim creation when the cache never had a fetch. The system can remove the cached path itself once the claims on that path drop to zero. Always add this number to gc.narUploadGraceHours. Set this option to 0 to keep nothing beyond this grace period.
gc.narUploadGraceHours unsigned int 24 GRADIENT_GC_NAR_UPLOAD_GRACE_HOURS Hours before deletion of an unreferenced NAR object or build-request blob. These hours cover the window between upload and the commit of database rows.
gc.orphanDerivationHours unsigned int 24 GRADIENT_GC_ORPHAN_DERIVATION_HOURS Hours before the deletion of a derivation outside the build closure of every retained evaluation. Quick re-evaluations can reuse the derivation during this grace. Set it to 0 to delete such derivations on the next run.

giteaApp

Option Type Default Env Description
giteaApp.clientId string - GRADIENT_GITEA_APP_CLIENT_ID The client ID of the OAuth2 application.
giteaApp.clientSecretFile path - GRADIENT_GITEA_APP_CLIENT_SECRET_FILE File for the client secret of an OAuth2 application. Register the application on the Git host with redirect URI <serveUrl>/api/v1/git-host-connections/oauth/callback.
giteaApp.enable bool false - Whether to enable an OAuth2 application for Gitea or Forgejo that project members can use for one-click connection to a Git host.
giteaApp.gitHostType one of gitea forgejo "forgejo" GRADIENT_GITEA_APP_GIT_HOST_TYPE Software to host Git on the instance.
giteaApp.instanceBaseUrl string - GRADIENT_GITEA_APP_INSTANCE_BASE_URL Base URL of the Gitea or Forgejo instance that has the OAuth2 application registered.

githubApp

Option Type Default Env Description
githubApp.enable bool false - Whether to enable the GitHub App integration for webhooks and CI status reports.
githubApp.id positive int - GRADIENT_GITHUB_APP_ID GitHub App ID, shown on the App's settings page.
githubApp.privateKeyFile path - GRADIENT_GITHUB_APP_PRIVATE_KEY_FILE File containing the GitHub App's RS256 private key in PEM format.
githubApp.webhookSecretFile path - GRADIENT_GITHUB_APP_WEBHOOK_SECRET_FILE File containing the secret for verifying GitHub App webhook payloads. It must match the secret set on the App's webhook settings page.

gradientCi

Option Type Default Env Description
gradientCi.enable bool true GRADIENT_GRADIENT_CI_ENABLE Whether to enable the Gradient.CI Servers offer on the workers pages.

http

Option Type Default Env Description
http.anonymousWebsocketMaxConnectionsPerIp positive int 256 GRADIENT_HTTP_ANONYMOUS_WEBSOCKET_MAX_CONNECTIONS_PER_IP The maximum number of simultaneously open connections from one client IP for a visitor without an account or API key. WebSocket connections and streams of build logs both count toward this limit. IPv6 addresses use the /64 network for this limit. The connection limit can put a ceiling on the number of database queries one address can cause. WebSocket connections repeat an access check once per minute. Streams of build logs poll the build twice per second. Browser tabs open at most two WebSocket connections and one stream of build logs. Extra connections get a 429 response. That response lasts until open connections from the address drop below the limit. Add the proxy entry to http.trustedProxies for a reverse proxy setup. All visitors share the proxy address without that entry.
http.cacheRequestBurst positive int 20000 GRADIENT_HTTP_CACHE_REQUEST_BURST Requests each client IP can make to the binary cache in a burst before http.cacheRequestsPerSecond applies.
http.cacheRequestsPerSecond positive int 1000 GRADIENT_HTTP_CACHE_REQUESTS_PER_SECOND Sustained requests per second each client IP can make to the binary cache (narinfo, NAR and cache proto endpoints). Nix asks for one narinfo per path of a closure.
http.localIps list of string [ "192.168.0.0/16" "172.16.0.0/12" "100.64.0.0/10" "10.0.0.0/8" "fc00::/7" ] GRADIENT_HTTP_LOCAL_IPS Clients in these CIDR ranges receive a cache's local_priority, if set and non-zero.
http.maxRequestSize positive int 2097152 GRADIENT_HTTP_MAX_REQUEST_SIZE Maximum HTTP request body size in bytes for most endpoints, to keep an unbounded body from exhausting server memory. Build request blob uploads use a fixed 20 MiB cap.
http.maxSourceUploadSize positive int 536870912 GRADIENT_HTTP_MAX_SOURCE_UPLOAD_SIZE Maximum size in bytes of a source upload to POST /build-requests/source (as sent by gradient build) and of a chunked manifest in total. The built-in reverse proxies raise their body size limit to fit it.
http.trustedProxies list of string [ "127.0.0.1/8" "::1/128" ] GRADIENT_HTTP_TRUSTED_PROXIES CIDR ranges of peers allowed to set X-Forwarded-For. The defaults trust a reverse proxy on the same host.

log

Option Type Default Env Description
log.chunkBytes positive int 262144 GRADIENT_LOG_CHUNK_BYTES Target uncompressed size in bytes of a stored build log chunk. Chunks split on line boundaries, and a long line can exceed the target.
log.level.cache null or one of trace debug info warn error null GRADIENT_LOG_LEVEL_CACHE Log level of the cache. Set it to null to use log.level.default.
log.level.default one of trace debug info warn error "info" GRADIENT_LOG_LEVEL_DEFAULT Default log level.
log.level.proto null or one of trace debug info warn error null GRADIENT_LOG_LEVEL_PROTO Log level of the protocol layer. Set it to null to use log.level.default.
log.level.scheduler null or one of trace debug info warn error null GRADIENT_LOG_LEVEL_SCHEDULER Log level of the scheduler. Set it to null to use log.level.default.
log.level.web null or one of trace debug info warn error null GRADIENT_LOG_LEVEL_WEB Log level of the web API. Set it to null to use log.level.default.
log.traceDir null or path null GRADIENT_LOG_TRACE_DIR Directory receiving every closed stage span of the server as JSON lines, one file per process. Set it to null to disable span tracing.

metrics

Option Type Default Env Description
metrics.cacheFlushIntervalSecs positive int 10 GRADIENT_METRICS_CACHE_FLUSH_INTERVAL_SECS Seconds between flushes of cache traffic counters to the database.
metrics.graphConsistencyIntervalSecs unsigned int 300 GRADIENT_METRICS_GRAPH_CONSISTENCY_INTERVAL_SECS Seconds between build graph consistency checks. These checks also repair the NAR reference counter. Set it to 0 to disable both.
metrics.instanceIntervalSecs positive int 30 GRADIENT_METRICS_INSTANCE_INTERVAL_SECS Seconds between updates of the instance-wide metric window.
metrics.labelTopn unsigned int 20 GRADIENT_METRICS_LABEL_TOPN Maximum distinct label values per rollup dimension, by activity.
metrics.otlp.endpoint null or string null GRADIENT_METRICS_OTLP_ENDPOINT OTLP collector endpoint to push metrics to. Set it to null to disable OTLP export.
metrics.otlp.pushIntervalSecs positive int 30 GRADIENT_METRICS_OTLP_PUSH_INTERVAL_SECS Seconds between OTLP metric pushes.
metrics.otlp.serviceName string "gradient" GRADIENT_METRICS_OTLP_SERVICE_NAME The service name that OTLP metrics and traces report.
metrics.otlp.tracesEndpoint null or string null GRADIENT_METRICS_OTLP_TRACES_ENDPOINT OTLP collector endpoint to push traces to. Set it to null to disable trace export.
metrics.otlp.tracesSampleRatio float 1.0 GRADIENT_METRICS_OTLP_TRACES_SAMPLE_RATIO Ratio of traces to export, from 0.0 (none) to 1.0 (all).
metrics.retention.rawDays unsigned int 14 GRADIENT_METRICS_RETENTION_RAW_DAYS Days to keep raw phase and worker samples and the per-minute cache and upstream traffic counters. Set it to 0 to keep them forever.
metrics.retention.rollupDays unsigned int 400 GRADIENT_METRICS_RETENTION_ROLLUP_DAYS Days to keep minute and hour rollups. Day and week rollups stay forever. Set it to 0 to keep every rollup forever.
metrics.rollupIntervalSecs positive int 60 GRADIENT_METRICS_ROLLUP_INTERVAL_SECS Seconds between metric rollup passes.
metrics.tokenFile null or path null GRADIENT_METRICS_TOKEN_FILE File containing the bearer token required to scrape GET /metrics. Set it to null to disable the endpoint.
metrics.workerSampleIntervalSecs positive int 15 GRADIENT_METRICS_WORKER_SAMPLE_INTERVAL_SECS Seconds between worker metric samples.

nar

Option Type Default Env Description
nar.chunkBytes int from 4096 to 4194304 524288 GRADIENT_NAR_CHUNK_BYTES Size in bytes of each outbound NarPush chunk, from 4 KiB to 4 MiB. Smaller chunks can help slow or high-latency links like Tailscale over DERP.
nar.hotCacheBytes unsigned int 536870912 GRADIENT_NAR_HOT_CACHE_BYTES Capacity in bytes of the in-memory NAR cache. Set it to 0 to disable the cache.
nar.maxConcurrentDownloads positive int 16 GRADIENT_NAR_MAX_CONCURRENT_DOWNLOADS NAR downloads from storage that can run at once across all connections, keeping the storage near its best total throughput.
nar.maxConcurrentServes positive int 8 GRADIENT_NAR_MAX_CONCURRENT_SERVES NAR serving tasks that can run at once per worker connection, bounding memory and storage fan-out for large batches.
nar.maxUploadSize positive int 536870912 GRADIENT_NAR_MAX_UPLOAD_SIZE Maximum size in bytes of a NAR uploaded to the cache upload endpoint.
nar.partialTtlSecs unsigned int 86400 GRADIENT_NAR_PARTIAL_TTL_SECS Maximum age in seconds of an unfinished upload staged under <baseDir>, counted from its last write. Older uploads disappear in the next deep GC. Set it to 0 to keep every unfinished upload.
nar.sendChunkTimeoutSecs positive int 30 GRADIENT_NAR_SEND_CHUNK_TIMEOUT_SECS Seconds an outbound NarPush chunk can wait for the WebSocket to drain before an abort of the transfer with NarAbort.
nar.smallBytes unsigned int 1048576 GRADIENT_NAR_SMALL_BYTES Size in bytes up to which NAR downloads come from the server itself instead of a presigned S3 URL. NARs up to this size also stay in the in-memory cache. Uploads do not depend on this value.
nar.storageOpenTimeoutSecs positive int 60 GRADIENT_NAR_STORAGE_OPEN_TIMEOUT_SECS Seconds to wait for a NAR object stream from storage (for example an S3 GET) before answering the worker with NarAbort. Workers retry after a NarAbort.

oidc

Option Type Default Env Description
oidc.clientId string - GRADIENT_OIDC_CLIENT_ID OIDC client ID.
oidc.clientSecretFile path - GRADIENT_OIDC_CLIENT_SECRET_FILE File containing the OIDC client secret.
oidc.discoveryUrl string - GRADIENT_OIDC_DISCOVERY_URL OIDC discovery URL.
oidc.enable bool false GRADIENT_OIDC_ENABLE Whether to enable OIDC.
oidc.required bool false GRADIENT_OIDC_REQUIRED Whether to enable OIDC as the only login method.
oidc.scopes list of string [ "openid" "email" "profile" ] GRADIENT_OIDC_SCOPES OIDC scopes to request.

outbound

Option Type Default Env Description
outbound.allowedNonPublicNetworkTargets list of string [ ] GRADIENT_OUTBOUND_ALLOWED_NON_PUBLIC_NETWORK_TARGETS The server can reach private network targets through URLs that project members enter. These targets include upstream caches, Git repositories for tasks, APIs of git hosts, actions and outbound webhooks. Workers connect to a Gradient server and use that server's list for Git connections of their jobs. Git connections from the Gradient server and workers fall under this list, but not Nix fetches of flake inputs and fixed-output builds. Each entry can be a CIDR range (10.0.0.0/8), an IP address, or an exact-match hostname (git.internal.example). Default settings allow the server to connect only to public addresses. Addresses of the server's own network interfaces don't count as public. They need entries too. The server doesn't detect addresses that network configuration can forward to the host without assigning them to an interface. Examples include kube-proxy service addresses and AnyIP routes. List self-hosted git hosts and internal caches here. Project members who can set such URLs can reach all listed targets. Servers trust the listed hostnames for every address that those hostnames resolve to. Loopback addresses and addresses for cloud metadata such as 169.254.169.254 also receive that trust. List only hostnames within managed DNS zones. The server can always connect to hosts in giteaApp.instanceBaseUrl.

packages

Option Type Default Env Description
packages.frontend package derived - The gradient-frontend package to use.
packages.server package derived - The gradient package to use.

permissions

Option Type Default Env Description
permissions.createCache one of none superusers everyone "everyone" GRADIENT_PERMISSIONS_CREATE_CACHE Who can create caches through the API: none (only the declarative state), superusers, or everyone (any authenticated user).
permissions.createProject one of none superusers everyone "everyone" GRADIENT_PERMISSIONS_CREATE_PROJECT Who can create projects through the API: none (only the declarative state), superusers, or everyone (any authenticated user).
permissions.createTeam one of none superusers everyone "everyone" GRADIENT_PERMISSIONS_CREATE_TEAM Who can create teams through the API: none (only the declarative state), superusers, or everyone (any authenticated user).

postgres

Option Type Default Env Description
postgres.effectiveCacheSize null or string null - effective_cache_size of the cluster set up by postgres.enable. Set it to three quarters of the host's RAM. It is a planner hint, not an allocation. Set it to null to keep the PostgreSQL default.
postgres.enable bool false - Whether to enable a local PostgreSQL database for Gradient.
postgres.maintenanceWorkMem null or string null - maintenance_work_mem of the cluster set up by postgres.enable, used for building indexes and by autovacuum. Each of autovacuum_max_workers can claim this much at once. Set it to null to keep the PostgreSQL default.
postgres.sharedBuffers null or string "512MB" - shared_buffers of the cluster set up by postgres.enable. Size it to a quarter of the host's RAM. Gradient's working set is the build graph's indexes, and the stock 128 MB cannot keep them resident. This value is a single fixed allocation, unlike work_mem and maintenance_work_mem. The default is a quarter of the smallest supported host. Raise it on larger hosts. Set it to null to keep the PostgreSQL default.
postgres.workMem null or string null - work_mem of the cluster set up by postgres.enable. Every sort or hash node in a query can claim this much. The scheduler's graph walks set a higher per-statement limit, except walks seeded by a root array, which keep the PostgreSQL default. Use "32MB" on a host sized for the three server pools; that is too much for a small host. null keeps the PostgreSQL default.

proto

Option Type Default Env Description
proto.allowWorkerUrlsOnPrivateNetworks bool false GRADIENT_PROTO_ALLOW_WORKER_URLS_ON_PRIVATE_NETWORKS Whether the server can connect to worker URLs on private, loopback, or link-local addresses. Leave this option off unless a worker is reachable only on an internal network. Otherwise, a project member with permission to manage workers can make the server open a connection to that network.
proto.anonymousCache.enable bool true GRADIENT_PROTO_ANONYMOUS_CACHE_ENABLE Whether unauthenticated clients can use GET /cache/{cache}/proto for public caches. Private caches always require an API key.
proto.anonymousCache.maxConnectionsPerIp positive int 32 GRADIENT_PROTO_ANONYMOUS_CACHE_MAX_CONNECTIONS_PER_IP Maximum simultaneous anonymous /cache/proto connections per client IP.
proto.assignmentReclaimGraceSecs unsigned int 600 GRADIENT_PROTO_ASSIGNMENT_RECLAIM_GRACE_SECS Seconds the server keeps the open assignments of a disconnected worker for the worker to report them in RunningJobs. After a server restart this covers the open assignments of every worker. Assignments nobody reports within this time are re-queued and count as a lost worker. A worker that disconnected with a maxLifetime gets at most its remaining lifetime. Assignments kept over a server restart get the full time. Set it to 0 to re-queue at once.
proto.discoverable bool true GRADIENT_PROTO_DISCOVERABLE Whether to enable incoming worker and federation connections on /proto.
proto.federate bool false GRADIENT_PROTO_FEDERATE Whether to enable federation with other Gradient servers over /proto.
proto.maxConnections positive int 256 GRADIENT_PROTO_MAX_CONNECTIONS Maximum simultaneous /proto WebSocket connections.
proto.maxConnectionsPerIp positive int 64 GRADIENT_PROTO_MAX_CONNECTIONS_PER_IP Maximum number of simultaneous /proto WebSocket connections from one IP address of a client. Raise this value when many workers connect through one NAT address.
proto.public bool false - Whether to enable exposing /proto through the reverse proxy for remote workers and federation.
proto.workerHeartbeatTimeoutSecs unsigned int 120 GRADIENT_PROTO_WORKER_HEARTBEAT_TIMEOUT_SECS Seconds a connected worker can stay silent before counting as dead, with its jobs re-queued. Workers heartbeat every 10 seconds, giving the default a tolerance of twelve missed beats. The timeout is the only detection for a worker lost without a clean TCP close (OOM kill, frozen host, network partition). Set it to 0 to disable the watchdog.

pullRequests

Option Type Default Env Description
pullRequests.commitEmail null or string null GRADIENT_PULL_REQUESTS_COMMIT_EMAIL Git author and committer email for commits of the open_pr action. Set it to null to use the default of the Git host, as listed for pullRequests.commitName.
pullRequests.commitName null or string null GRADIENT_PULL_REQUESTS_COMMIT_NAME Git author and committer name for commits of the open_pr action. Set it to null to use the default of the Git host. - GitHub: the App bot, with the commit marked as verified. - Gitea, Forgejo and GitLab: the token owner, with Gradient <gradient@users.noreply.HOST> as fallback. Grant the token the read:user or read_user scope for the owner lookup.

registration

Option Type Default Env Description
registration.enable bool false GRADIENT_REGISTRATION_ENABLE Whether to enable self-service user registration.

reverseProxy

Option Type Default Env Description
reverseProxy.caddy.enable bool false - Whether to enable a Caddy virtual host for Gradient.
reverseProxy.caddy.extraConfig strings concatenated with "\n" "" - Additional lines appended to services.caddy.virtualHosts.<name>.extraConfig after the reverse proxy setup.
reverseProxy.caddy.useACMEHost null or string null - Host of an existing ACME certificate, passed to services.caddy.virtualHosts.<name>.useACMEHost. Caddy reuses it instead of requesting a new certificate. null keeps certificate management with Caddy.
reverseProxy.nginx.enable bool !reverseProxy.caddy.enable - Whether to enable an nginx virtual host for Gradient.
reverseProxy.nginx.manageTls bool true - Whether to let nginx obtain and present the TLS certificate itself through the virtual host's enableACME and forceSSL settings. Disable it for upstream proxies (Traefik, Cloudflare, load balancers) that terminate TLS and forward plain HTTP to nginx. Keep useTls enabled in that case for https:// URLs and Secure session cookies. Has no effect with useTls disabled.
reverseProxy.nginx.useACMEHost null or string null - Host of an existing ACME certificate, passed to services.nginx.virtualHosts.<name>.useACMEHost. Nginx reuses it instead of requesting a new certificate. null keeps certificate management with Nginx. Exclusive with reverseProxy.nginx.manageTls. Has no effect with useTls disabled.

s3

Option Type Default Env Description
s3.accessKeyId null or string null GRADIENT_S3_ACCESS_KEY_ID AWS access key ID. Set it to null to use instance credentials or the environment.
s3.bucket string "" GRADIENT_S3_BUCKET Name of the S3 bucket. The bucket must not have versioning, object lock or replication enabled. Object overwrites happen in place, and old versions stay in the bucket. Versioned buckets thus keep an unreclaimable copy per upload.
s3.enable bool false - Whether to enable storing NARs in S3.
s3.endpoint null or string null GRADIENT_S3_ENDPOINT Endpoint of an S3-compatible service such as MinIO or Cloudflare R2. Set it to null to use AWS.
s3.maxRetries unsigned int 3 GRADIENT_S3_MAX_RETRIES Retries of a failed S3 request.
s3.prefix string "" GRADIENT_S3_PREFIX Key prefix inside the bucket, such as gradient/. Leave it empty to store at the bucket root.
s3.readTimeoutSecs unsigned int 60 GRADIENT_S3_READ_TIMEOUT_SECS The number of seconds that pass without progress before an S3 request can fail. Bytes of the request body that were sent, response headers and response data that was received all count as progress. Uploads and downloads of any size continue when progress is present.
s3.region string "us-east-1" GRADIENT_S3_REGION Region of the S3 bucket.
s3.retryTimeoutSecs unsigned int 250 GRADIENT_S3_RETRY_TIMEOUT_SECS S3 retries no longer start after this many seconds from the first attempt. Set a value greater than (maxRetries + 1) * readTimeoutSecs to keep retrying requests that fail due to lack of progress. Retries reuse the original credentials. Keep this value below 5 minutes as well.
s3.secretAccessKeyFile null or path null GRADIENT_S3_SECRET_ACCESS_KEY_FILE File containing the AWS secret access key. Set it to null to use instance credentials.
s3.virtualHostedStyle bool false GRADIENT_S3_VIRTUAL_HOSTED_STYLE Whether to address a custom s3.endpoint virtual-hosted style (https://<bucket>.<endpoint>/key) instead of path style (https://<endpoint>/<bucket>/key). MinIO, Garage and most self-hosted services need path style. It has no effect without a custom endpoint.

scheduler

Option Type Default Env Description
scheduler.clusterPrepareTimeoutSecs positive int 30 GRADIENT_SCHEDULER_CLUSTER_PREPARE_TIMEOUT_SECS Seconds for every member of a cluster job attempt to accept its assignment. Attempts not accepted by all members in time abort, and their cluster jobs return to the queue.
scheduler.clusterReserveAfterSecs positive int 600 GRADIENT_SCHEDULER_CLUSTER_RESERVE_AFTER_SECS Seconds cluster jobs that can start wait for enough simultaneously idle workers before reserving a placement. Reserved workers receive no new single jobs until the cluster job's start or the reservation's expiry.
scheduler.clusterReserveTimeoutSecs positive int 1800 GRADIENT_SCHEDULER_CLUSTER_RESERVE_TIMEOUT_SECS Number of seconds to keep a reservation for a cluster job before release. Cluster jobs wait one cluster-reserve-after period before they can reserve workers again.
scheduler.inputFetchTimeoutSecs positive int 3600 GRADIENT_SCHEDULER_INPUT_FETCH_TIMEOUT_SECS Seconds for a worker to respond to an input fetch. A different worker takes over a fetch with no response in time if that worker can fetch it. Waiting evaluations end in failure if no connected workers remain.
scheduler.scoringPolicy one of simple resource-aware "resource-aware" GRADIENT_SCHEDULER_SCORING_POLICY Policy ranking queued jobs for a requesting worker. Factors of simple: path availability, NAR size, dependency count, waiting time, builtins and fetch worker reservation. Factors of resource-aware: the same plus memory fit, worker saturation, CPU, disk and network affinity and preferLocalBuild.

scim

Option Type Default Env Description
scim.enable bool false GRADIENT_SCIM_ENABLE Whether to enable SCIM provisioning.
scim.hardDelete bool false GRADIENT_SCIM_HARD_DELETE Whether to enable deleting users on SCIM DELETE instead of disabling them.
scim.tokenFile path - GRADIENT_SCIM_TOKEN_FILE File containing the SCIM bearer token.

secrets

Option Type Default Env Description
secrets.cryptFile path - GRADIENT_SECRETS_CRYPT_FILE File containing the key used to encrypt secrets in the database.
secrets.jwtFile path - GRADIENT_SECRETS_JWT_FILE File containing the secret used to sign JWTs.

sentry

Option Type Default Env Description
sentry.dsn null or string null GRADIENT_SENTRY_DSN Sentry DSN to use with sentry.enable set. Set it to null to send reports to the upstream Wavelens instance at reports.wavelens.io.
sentry.enable bool false GRADIENT_SENTRY_ENABLE Whether to enable error reporting to Sentry.

ssh

Option Type Default Env Description
ssh.enable bool false GRADIENT_SSH_ENABLE Whether to enable Nix daemon via SSH for ssh-ng:// substituters, nix copy and nixos-rebuild --build-host, plus gRPC on web port for same grpc:// store of nix-grpc-store (project API key in token-file).
ssh.hostKeyFile null or path null GRADIENT_SSH_HOST_KEY_FILE File containing the OpenSSH private host key. Set it to null to generate an ed25519 key in baseDir on first start.
ssh.listenAddresses list of string [ "::" ] GRADIENT_SSH_LISTEN_ADDRESSES IP addresses for the SSH server to listen on. IPv6 addresses also accept IPv4 clients. The default :: thus means listening on every address of both families.
ssh.openFirewall bool false - Whether to enable the SSH port in the firewall.
ssh.port port 2222 GRADIENT_SSH_PORT Port for the SSH server to listen on.

upload

Option Type Default Env Description
upload.bytesBudget positive int 8589934592 GRADIENT_UPLOAD_BYTES_BUDGET Total size in bytes of admitted uploads. Uploads that exceed the remaining budget wait. An upload larger than the whole budget can run alone once nothing else is in flight.
upload.concurrency positive int 8 GRADIENT_UPLOAD_CONCURRENCY The number of uploads over 1 MiB (NAR and eval cache segments) that run at the same time. All workers, REST clients and SSH nix copy clients share this limit. Smaller uploads have a dedicated pool of 128 slots. Uploads count against this limit until their objects reach storage. Other uploads then wait for free capacity. A single nix copy can take at most half of these slots, with a minimum of one.
upload.leaseIdleSecs positive int 300 GRADIENT_UPLOAD_LEASE_IDLE_SECS Seconds granted worker uploads can go without data before they lose their permit and their workers receive a request to retry.
upload.restWaitSecs positive int 30 GRADIENT_UPLOAD_REST_WAIT_SECS Seconds that uploads of NARs to the upload endpoint of the cache and new store paths sent over SSH with nix copy wait for a permit. The upload endpoint can return a 503 answer with Retry-After once the wait time is over. nix copy can fail with "upload capacity exhausted, retry later". Store paths in the cache need no permit.

worker

Option Type Default Env Description
worker.acceptedServerTokensFile null or path null GRADIENT_WORKER_ACCEPTED_SERVER_TOKENS_FILE File of token hashes required from connecting servers, with peer_id:hash per line and # starting a comment. A hash is an argon2 PHC string or the lowercase SHA-256 hex digest of the token itself, for example from printf %s "$TOKEN" \| sha256sum. Peer ID * matches any peer. The worker reads this file only with GRADIENT_WORKER_DISCOVERABLE. Use null to accept every server. This value needs worker.allowDiscoverableWithoutAcceptedServerTokensFile.
worker.allowDiscoverableWithoutAcceptedServerTokensFile bool false - Set worker.discoverable and leave worker.acceptedServerTokensFile unset to accept every server that can connect. This setting is for closed networks only.
worker.baseDir path "/var/lib/gradient-worker" GRADIENT_WORKER_BASE_DIR Directory holding the worker's state.
worker.discoverable bool false GRADIENT_WORKER_DISCOVERABLE Whether to enable incoming server connections on /proto.
worker.domain string "" - Domain of the worker's reverse proxy virtual host. Only applies with a reverse proxy enabled.
worker.enable bool false - Whether to enable the Gradient worker.
worker.endpoint null or string null GRADIENT_WORKER_ENDPOINT Address at which other members of a cluster job connect to this worker, passed through verbatim in the cluster roster. null advertises none.
worker.environmentVariables lazy attribute set of (null or bool or int or string or path) { } - Environment variables of the Gradient worker. The configuration reference lists every variable and its default. Set a variable to null to unset it.
worker.gcrootsDir string "/nix/var/nix/gcroots/gradient" GRADIENT_WORKER_GCROOTS_DIR Directory for the indirect GC roots pinning each running build's inputs and outputs against a concurrent nix-collect-garbage. An empty string disables pinning.
worker.id null or string null GRADIENT_WORKER_ID Worker UUID. null generates one on first start and stores it in <worker.baseDir>/worker-id. Set it when the UUID must be known in advance, for example to register the worker in state.workers.
worker.idleTimeout null or (unsigned int) null GRADIENT_WORKER_IDLE_TIMEOUT Seconds without an assigned job after which the worker drains and exits. null keeps it running.
worker.listenAddr string "127.0.0.1" GRADIENT_WORKER_LISTEN_ADDR IP address the worker listens on for incoming server connections.
worker.maxLifetime null or (unsigned int) null GRADIENT_WORKER_MAX_LIFETIME Seconds after start after which the worker drains, finishes its running jobs and exits. null keeps it running.
worker.peersFile null or path null GRADIENT_WORKER_PEERS_FILE File of peer tokens for challenge-response authentication with the server, with peer_id:token per line and # starting a comment. <uuid>:<token> *:<token> Use peer ID * to match any UUID in the server's challenge. Tokens are 48 byte random secrets, for example from openssl rand -base64 48. Register them via the API through POST /api/v1/projects/{project}/workers. Set it to null for open mode without authentication; avoid that in a production setup.
worker.port port 3100 GRADIENT_WORKER_PORT Port the worker listens on for incoming server connections.
worker.releaseGuestTaps null or string null GRADIENT_WORKER_RELEASE_GUEST_TAPS Release the tap for the guest with this id after exit of the root supervisor and after a force-kill (internal - do not set manually).
worker.serverUrl null or string null GRADIENT_WORKER_SERVER_URL WebSocket URL of the Gradient server's /proto endpoint. null skips the outbound connection, leaving only incoming server connections through worker.discoverable.
worker.useTls bool true - Whether to enable TLS.
worker.zone null or string null GRADIENT_WORKER_ZONE Locality label advertised to the scheduler. A cluster job asking for one zone places every member on workers with the same label. null places the worker among the unlabelled workers.

worker.build

Option Type Default Env Description
worker.build.cgroup null or string if worker.build.metrics then "/sys/fs/cgroup/system.slice/nix-daemon.service" else null GRADIENT_WORKER_BUILD_CGROUP Cgroup directory of nix-daemon.service, the parent of the build cgroups. The worker reads each running build's peak memory from it and sends the values with its heartbeat. The scheduler reserves the larger of the predicted and the reported peak. The build cgroups need worker.build.metrics and Gradient's Nix fork on the daemon. null reports nothing.
worker.build.maxConcurrent positive int 32 GRADIENT_WORKER_BUILD_MAX_CONCURRENT Maximum simultaneous builds.
worker.build.maxCores null or (positive int) null GRADIENT_WORKER_BUILD_MAX_CORES CPU cores for a build, passed as --cores. null for every core.
worker.build.metrics bool false - Whether to record per-build peak memory, CPU time, disk I/O and out-of-memory kills. This turns on Nix's experimental cgroups feature and use-cgroups setting and delegates cgroup controllers to nix-daemon.service. The daemon reports the values in each build result. Peak memory, disk I/O and OOM kills need Gradient's Nix fork on the daemon. Set this option or enable worker.capabilities.eval to make the fork the default for nix.package. Write operations to the store on this fork begin with the Nix daemon acquiring the write lock of the Nix database. Concurrent evaluations wait on that lock. They don't sleep and retry. The metrics always include wall time.
worker.build.oomScoreAdjust null or integer between -1000 and 1000 (both inclusive) 500 - Out-of-memory score adjustment for nix-daemon.service, inherited by every build process. A positive value makes the kernel kill a build process before the worker when the host runs out of memory, failing only that build. Evaluation subprocesses use 600 and die first. null leaves the daemon unchanged.

worker.capabilities

Option Type Default Env Description
worker.capabilities.build bool true GRADIENT_WORKER_CAPABILITIES_BUILD Whether to run Nix builds.
worker.capabilities.eval bool true GRADIENT_WORKER_CAPABILITIES_EVAL Whether to run Nix flake evaluation. The NixOS module can then set Gradient's Nix fork as the default for nix.package.
worker.capabilities.exec bool false GRADIENT_WORKER_CAPABILITIES_EXEC Whether this worker takes exec jobs. Exec jobs also need the server option exec.enable, exec_enabled on the task and enable_exec on the worker registration.
worker.capabilities.federate bool false GRADIENT_WORKER_CAPABILITIES_FEDERATE Whether to forward work and NARs between workers and servers (requires discoverable).
worker.capabilities.network bool true GRADIENT_WORKER_CAPABILITIES_NETWORK Whether this worker may reach the internet. Cloning repositories, fetching flake inputs, substitutions, downloads and fixed-output builds run only on workers with it.
worker.capabilities.secrets bool true GRADIENT_WORKER_CAPABILITIES_SECRETS Whether the server may send project credentials such as SSH keys to this worker.

worker.eval

Option Type Default Env Description
worker.eval.cache.dir null or string null GRADIENT_WORKER_EVAL_CACHE_DIR Eval cache directory, exported to evaluation subprocesses as NIX_CACHE_HOME. null uses <worker.baseDir>/eval-cache.
worker.eval.cache.share bool true GRADIENT_WORKER_EVAL_CACHE_SHARE Whether to share the eval cache with other workers through the server. Evaluations pull the segments of other workers first and upload new rows as segments while they run.
worker.eval.forkWorkers null or (positive int) null GRADIENT_WORKER_EVAL_FORK_WORKERS Evaluation subprocesses in the pool, equal to the evaluation concurrency. null sizes the pool to the host's core count, capped at 16.
worker.eval.maxConcurrent positive int 1 GRADIENT_WORKER_EVAL_MAX_CONCURRENT Maximum simultaneous evaluations.
worker.eval.maxMemory null or (positive int) null GRADIENT_WORKER_EVAL_MAX_MEMORY Ceiling in MiB for the resident memory of all evaluation subprocesses together. Subprocesses leave the pool largest first while the total exceeds the ceiling. Conflicts with worker.system.minFreeRamMb.
worker.eval.maxRss positive int 2147483648 GRADIENT_WORKER_EVAL_MAX_RSS Resident memory in bytes for an idle evaluation subprocess. Subprocesses above the limit restart after the call and free the Nix heap. A call growing past the limit is fine, with worker.system.minFreeRamMb as the host's guard. Keep it above a typical evaluation's heap.
worker.eval.metrics bool true GRADIENT_WORKER_EVAL_METRICS Whether to collect per-evaluation Nix statistics (thunks, heap, peak memory, hotspots, flake graph). Disable it to skip that overhead.

worker.exec

Option Type Default Env Description
worker.exec.allow.allowedPrivateNetworks list of string matching the pattern [0-9]{1,3}(.[0-9]{1,3}){3}/[0-9]{1,2}|[0-9a-fA-F:]:[0-9a-fA-F:]/[0-9]{1,3} [ ] - Use this option to allow specific private IPv4 and IPv6 networks. Guest network filters drop per default private, shared and link-local destinations (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 100.64.0.0/10, 169.254.0.0/16, etc.) and all IPv6 destinations outside 2000::/3. Guests with network access can still reach networks explicitly allowed in this option. IPv6 entries only have an effect when exec.subnet.v6 is set. Add the guest subnets of other workers for multi-node jobs. Add private hosts that the job needs. Guests on this worker cannot reach each other, even if those subnets appear in the list.
worker.exec.allow.blockedGlobalIPv6Networks list of string matching the pattern [0-9a-fA-F:]:[0-9a-fA-F:]/[0-9]{1,3} [ ] - IPv6 networks that a guest is forbidden to connect to. Set this option together with exec.subnet.v6. The global IPv6 prefixes of the host's own network (eg: the hosts LAN prefix) should be set here, too. The default of [ ] blocks nothing. This option is ineffective without exec.subnet.v6.
worker.exec.allow.customImages bool false GRADIENT_WORKER_EXEC_ALLOW_CUSTOM_IMAGES Whether exec jobs may boot their own guest image instead of worker.exec.image.
worker.exec.allow.devices list of string [ ] GRADIENT_WORKER_EXEC_ALLOW_DEVICES Device names from worker.exec.devices exec jobs may request. An empty list allows none.
worker.exec.allow.guestConnectableHostTcpPorts list of port [ ] - TCP ports on the worker host that a guest with network access can reach. Guest network filters drop all other connections from a guest to the host. A DNS forwarder for guests on the host makes DNS to the bridge address the exception. These ports are also open on the host firewall for the guest bridge. Set this option when the Gradient server and the jobs share a host and the jobs need to reach its API.
worker.exec.allow.maxSilent null or (unsigned int) null GRADIENT_WORKER_EXEC_ALLOW_MAX_SILENT Most seconds an exec job may go without output. The server lowers a larger request to this value. null sets no cap.
worker.exec.allow.mounts list of string [ ] GRADIENT_WORKER_EXEC_ALLOW_MOUNTS Mount names from worker.exec.mounts exec jobs may request. An empty list allows none.
worker.exec.allow.network bool false GRADIENT_WORKER_EXEC_ALLOW_NETWORK Whether exec jobs reach the network through worker.exec.bridge. The worker module adds steps to nftables.service when networking.nftables.enable is on. Those steps restore the guest filter after stop/start.
worker.exec.allow.nodes unsigned int 1 GRADIENT_WORKER_EXEC_ALLOW_NODES Most nodes an exec job may span.
worker.exec.allow.ports null or (list of (string matching the pattern [0-9]{1,5}(-[0-9]{1,5})? or port or list of port)) null GRADIENT_WORKER_EXEC_ALLOW_PORTS Exec jobs can request guest ports. Each entry is a port like "22" or a range like "8000-8100". Older forms 22 and [ 8000 8100 ] remain valid. No ports pass with an empty list. null is the range 1024 to 65535.
worker.exec.allow.retries unsigned int 0 GRADIENT_WORKER_EXEC_ALLOW_RETRIES Most retries an exec job may request.
worker.exec.allow.ssh bool false GRADIENT_WORKER_EXEC_ALLOW_SSH Whether exec jobs may accept SSH sessions into their guest.
worker.exec.allow.timeout null or (unsigned int) null GRADIENT_WORKER_EXEC_ALLOW_TIMEOUT Most seconds an exec job may run. The server lowers a larger request to this value. null sets no cap.
worker.exec.bridge string "gradient-guests" GRADIENT_WORKER_EXEC_BRIDGE Network bridge the guest tap devices join.
worker.exec.defaults.maxSilent null or (unsigned int) null GRADIENT_WORKER_EXEC_DEFAULTS_MAX_SILENT Seconds without output after which an exec job that leaves maxSilent unset times out. null sets no limit.
worker.exec.defaults.mounts list of string [ ] GRADIENT_WORKER_EXEC_DEFAULTS_MOUNTS Mounts of an exec job that leaves mounts unset.
worker.exec.defaults.network bool false GRADIENT_WORKER_EXEC_DEFAULTS_NETWORK Whether an exec job that leaves network unset reaches the network.
worker.exec.defaults.ssh bool false GRADIENT_WORKER_EXEC_DEFAULTS_SSH Whether an exec job that leaves ssh unset accepts SSH sessions.
worker.exec.devices list of (submodule) [ ] GRADIENT_WORKER_EXEC_DEVICES Devices that exec jobs can ask for. Set exactly vfio, dev or usb per entry. Devices held by a job stay out of reach for other jobs.
worker.exec.devices.*.dev null or path null - Host device file for the guest, relayed over vsock.
worker.exec.devices.*.name string - - Device class name that exec jobs ask for.
worker.exec.devices.*.projects value "all" (singular enum) or list of string matching the pattern [0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12} - - Projects with jobs that can use this entry: "all", or a list of project UUIDs. This entry is not present for jobs in projects outside the list.
worker.exec.devices.*.usb null or string matching the pattern [0-9a-f]{4}:[0-9a-f]{4} null - USB device as vendor:product, attached to the guest over USB/IP.
worker.exec.devices.*.vfio list of string [ ] - PCI addresses of the devices in this class, a device per address. The worker hot-plugs them into the guest over VFIO. Bind each device to vfio-pci first.
worker.exec.guestCpus null or (unsigned int) null GRADIENT_WORKER_EXEC_GUEST_CPUS CPUs the running and warm guests of this worker share. An exec job waits until its cpus fit. null uses the CPU count of the host.
worker.exec.guestDiskMb null or (unsigned int) null GRADIENT_WORKER_EXEC_GUEST_DISK_MB Disk space in MB the /work disks of the running guests share. An exec job waits until its diskMb fits. null uses 80 % of the free space in <worker.baseDir>/guests when the worker starts.
worker.exec.guestMemoryMb null or (unsigned int) null GRADIENT_WORKER_EXEC_GUEST_MEMORY_MB Memory in MB the running and warm guests of this worker share. An exec job waits until its memoryMb fits. null uses 80 % of the host memory.
worker.exec.guestStoreMb unsigned int 20480 GRADIENT_WORKER_EXEC_GUEST_STORE_MB Size in MB of the writable /nix/store disk each guest boots with. It holds the paths an exec job copies into the guest store or builds there. The disk image is sparse and takes only the space the guest writes, outside of worker.exec.guestDiskMb.
worker.exec.image package derived GRADIENT_WORKER_EXEC_IMAGE Guest image for exec jobs, built with gradient.lib.mkWorkerImage.
worker.exec.labels list of string [ ] GRADIENT_WORKER_EXEC_LABELS Labels an exec job can ask for. The worker ID is always a label too.
worker.exec.maxPreWarm unsigned int 3 GRADIENT_WORKER_EXEC_MAX_PRE_WARM Most guests kept warm for upcoming exec jobs the server reports. The worker keeps the larger of worker.exec.preWarm and the reported count, capped at this value. 0 ignores the server count.
worker.exec.mounts list of (submodule) [ ] GRADIENT_WORKER_EXEC_MOUNTS Host directories that exec jobs can ask for.
worker.exec.mounts.*.name string - - Mount name that exec jobs ask for. Guests find the mount at /mnt/<name>.
worker.exec.mounts.*.path path - - Host directory for the guest, shared over virtiofs.
worker.exec.mounts.*.perJob bool false - Whether to give each job a fresh directory below path, deleted after the job.
worker.exec.mounts.*.projects value "all" (singular enum) or list of string matching the pattern [0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12} - - Projects with jobs that can use this entry: "all", or a list of project UUIDs. This entry is not present for jobs in projects outside the list.
worker.exec.mounts.*.readOnly bool false - Whether to share the directory read-only.
worker.exec.nameservers list of string [ ] GRADIENT_WORKER_EXEC_NAMESERVERS IPv4 addresses of the nameservers for guests with network access. An empty list uses the address of worker.exec.bridge, where the NixOS module runs a DNS forwarder.
worker.exec.noSwap bool false - Whether to keep the worker service and gradient-guests.slice out of swap. Guest memory and the secrets in it then stay in RAM. Under memory pressure the kernel kills guests and worker processes instead of swapping them out.
worker.exec.preWarm unsigned int 0 GRADIENT_WORKER_EXEC_PRE_WARM Guests booted from worker.exec.image and paused, waiting for a job.
worker.exec.sops.files list of (submodule) [ ] GRADIENT_WORKER_EXEC_SOPS_FILES Sops files that the worker can decrypt with worker.exec.sops.keyFile. Exec jobs fetch top-level values from a file by name, but only for jobs of projects in projects of that file. Values never reach the server.
worker.exec.sops.files.*.path path - - Path of the sops file on the worker host.
worker.exec.sops.files.*.projects value "all" (singular enum) or list of string matching the pattern [0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12} - - Projects with jobs that can use this entry: "all", or a list of project UUIDs. This entry is not present for jobs in projects outside the list.
worker.exec.sops.keyFile null or path null GRADIENT_WORKER_EXEC_SOPS_KEY_FILE SSH private key decrypting worker.exec.sops.files, an Ed25519 or RSA key. The age recipient derives from it. The worker reads it through a systemd credential, and systemctl reload gradient-worker decrypts the files again. null decrypts no file.
worker.exec.stopGuestsWithWorker bool true GRADIENT_WORKER_EXEC_STOP_GUESTS_WITH_WORKER Whether stopping or restarting the worker stops every guest. The server queues the exec jobs of stopped guests again without using a retry. false keeps guests running across a worker restart and the restarted worker reattaches to them.
worker.exec.subnet (submodule) or string convertible to it { } - Guest bridge subnets. Set v4 and optionally v6.
worker.exec.subnet.v4 null or string null GRADIENT_WORKER_EXEC_SUBNET_V4 IPv4 subnet for worker.exec.bridge. Set this option when worker.capabilities.exec is on. Choose a subnet without overlap with other networks on the host. The bridge address is the first host address. Guests with network access get the lowest unused address after the bridge address. Exec jobs that span multiple nodes need a separate subnet on each Exec worker in the zone.
worker.exec.subnet.v6 null or string null GRADIENT_WORKER_EXEC_SUBNET_V6 The IPv6 subnet for worker.exec.bridge. Guests get no IPv6 address from null. Guests with network access get an address in this subnet with the same host offset as their IPv4 address in worker.exec.subnet.v4. They can reach the internet through IPv6 masquerade. The bridge address is the first host address. The prefix length must fall between 64 and the worker.exec.subnet.v4 prefix length plus 96. Host bits must be zero. A random unique local /64 (fd00::/8) can fit.

worker.log

Option Type Default Env Description
worker.log.burstBytesPerMin unsigned int 33554432 GRADIENT_WORKER_LOG_BURST_BYTES_PER_MIN The limit on bytes of build log that the worker can forward for each build in any one minute. The worker can pause the log for a build over this limit and resume it when the rate is lower. A note can give the number of skipped lines. The build itself can continue.
worker.log.fetchFromStore bool true GRADIENT_WORKER_LOG_FETCH_FROM_STORE Whether to forward saved build logs for derivations that already built locally and produce no new logs. Forwarded logs get a cutoff at burstBytesPerMin.
worker.log.level.build null or one of trace debug info warn error null GRADIENT_WORKER_LOG_LEVEL_BUILD Log level of the builder. null uses worker.log.level.default.
worker.log.level.default one of trace debug info warn error "info" GRADIENT_WORKER_LOG_LEVEL_DEFAULT Default log level.
worker.log.level.eval null or one of trace debug info warn error null GRADIENT_WORKER_LOG_LEVEL_EVAL Log level of the evaluator. null uses worker.log.level.default.
worker.log.level.proto null or one of trace debug info warn error null GRADIENT_WORKER_LOG_LEVEL_PROTO Log level of the protocol layer. null uses worker.log.level.default.
worker.log.sustainedBytesPerHour unsigned int 536870912 GRADIENT_WORKER_LOG_SUSTAINED_BYTES_PER_HOUR Build log bytes forwarded per build within any hour.
worker.log.traceDir null or path null GRADIENT_WORKER_LOG_TRACE_DIR Directory receiving every closed stage span of the worker and its eval subprocesses as JSON lines, one file per process. null disables span tracing.

worker.nar

Option Type Default Env Description
worker.nar.chunkBytes int from 4096 to 4194304 524288 GRADIENT_WORKER_NAR_CHUNK_BYTES Size in bytes of each outbound NAR upload chunk, from 4 KiB to 4 MiB. Smaller chunks can help slow or high-latency links like Tailscale over DERP.
worker.nar.maxConcurrentUploads positive int 16 GRADIENT_WORKER_NAR_MAX_CONCURRENT_UPLOADS Upload requests over 1 MiB open at once, waiting for a server grant or transferring. Half of the limit for any job, a window of 128 for smaller uploads. The server's upload budget decides how many run and bounds the worker's memory.
worker.nar.partialTtlSecs unsigned int 86400 GRADIENT_WORKER_NAR_PARTIAL_TTL_SECS Seconds after the last write before the worker deletes an unfinished NAR download under <worker.baseDir>/nar-partial. 0 for no cleanup.

worker.nixDaemon

Option Type Default Env Description
worker.nixDaemon.maxConnections null or (positive int) null GRADIENT_WORKER_NIX_DAEMON_MAX_CONNECTIONS Maximum number of connections to the local Nix daemon. The value for an unset option is 9 x worker.build.maxConcurrent + 16 if worker.capabilities.build is on and 16 otherwise. A build can keep one connection open for the whole run and open up to 8 more for parallel NAR imports. Short path lookups use up to 32 connections at once. The idle connections in the pool set the upper limit.

worker.packages

Option Type Default Env Description
worker.packages.cloudHypervisor package derived - The cloud-hypervisor package to use.
worker.packages.git package derived - Git package available to the worker for cloning repositories.
worker.packages.gradient package derived - The gradient package to use.
worker.packages.ssh package derived - OpenSSH package used as GIT_SSH_COMMAND to fetch private flake inputs.
worker.packages.usbip package derived - USB/IP package with usbipd and usbip, for worker.exec.devices entries with usb.
worker.packages.virtiofsd package derived - The virtiofsd package to use.

worker.reverseProxy

Option Type Default Env Description
worker.reverseProxy.caddy.enable bool false - Whether to enable a Caddy virtual host for the worker listener.
worker.reverseProxy.caddy.extraConfig strings concatenated with "\n" "" - Additional lines appended to services.caddy.virtualHosts.<name>.extraConfig after the reverse proxy setup.
worker.reverseProxy.caddy.useACMEHost null or string null - Host of an existing ACME certificate, passed to services.caddy.virtualHosts.<name>.useACMEHost. Caddy reuses it instead of requesting a new certificate. null keeps certificate management with Caddy.
worker.reverseProxy.nginx.enable bool false - Whether to enable an nginx virtual host for the worker listener.

worker.system

Option Type Default Env Description
worker.system.architectures list of string derived GRADIENT_WORKER_SYSTEM_ARCHITECTURES Nix system types this worker builds for.
worker.system.cpuCoreScore null or (positive int) null GRADIENT_WORKER_SYSTEM_CPU_CORE_SCORE Single-core speed score advertised to the scheduler; higher is faster. null benchmarks the host at startup.
worker.system.features list of string [ ] GRADIENT_WORKER_SYSTEM_FEATURES Nix system features this worker advertises. An empty list uses the system features of the Nix store, including those that enabled experimental features imply, such as recursive-nix.
worker.system.minFreeRamMb unsigned int 0 GRADIENT_WORKER_SYSTEM_MIN_FREE_RAM_MB Free memory in MiB below which the worker kills the one evaluation subprocess large enough to restore the margin and reports that evaluation as failed instead of letting the host freeze. 0 uses 10% of total memory, clamped to 128 MiB to 1 GiB. worker.eval.maxRss still bounds steady-state memory.

Build Failures

A failed build ends in one of three states.

Status Retried Cause
FailedPermanent No The builder exited with a non-zero code, or no connected worker had enough free memory
FailedTransient Yes, build.maxAttempts times with a doubling build.retryBackoffSecs Out of memory, full disk, network or substitution failure, builder crash
FailedTimeout No build.defaultTimeoutSecs or build.defaultMaxSilentSecs exceeded

Derivations can override the server defaults through timeout, maxSilent and preferLocalBuild. The meta.* attributes never reach the .drv, so they have no effect here.

Local Worker

Set localWorker and worker.enable to register the worker on the same host automatically. Registration has three parts.

  • A stable worker ID, derived from the host name.
  • A token in /var/lib/gradient-worker/local-token, generated at first start. Delete the file and restart both services to rotate the token.
  • Membership in a team server declared in state. Projects only get workers when admins grant the server team with workers on that project. All new projects receive a worker with grantLocalWorkerToNewProjects set.

Jobs on the local worker run on the server host. They can access its Nix store and network. Only superusers can create projects by default. Set permissions.createProject = "everyone" to allow all signed-in users to create projects again.

Worker connection attempts use backoff capped at 60 seconds. They wait for a project with a cache subscription to grant team server the workers flag.

Postgres Sizing

With postgres.enable, host-independent defaults come from mkDefault entries.

Setting Default Reason
random_page_cost 1.1 Matches SSD storage and keeps the planner on index-only scans of the graph tables
max_connections 200 Room for three server pools (56 connections by default), a fixed pool of 2 connections for waiting evaluations, autovacuum and psql
max_locks_per_transaction 1024 Graph writes lock every shared build they touch. The server logs warnings below 256
wal_compression zstd Shrinks the full page images in the write-ahead log
wal_buffers 64MB Keeps large graph writes from flushing the write-ahead log mid-transaction
checkpoint_timeout 15min Fewer checkpoints mean fewer full page images after each one
synchronous_commit off A commit no longer waits for the disk. A database crash loses at most the last second of commits, with no corruption

RAM-dependent settings live in module options.

Option Rule of thumb
postgres.sharedBuffers A quarter of the RAM, e.g. "4GB" on 16 GB
postgres.effectiveCacheSize Three quarters of the RAM, e.g. "12GB" on 16 GB
postgres.workMem "32MB" for the default pool sizes
postgres.maintenanceWorkMem Up to "1GB" with RAM to spare

All eleven values are manual for an external database (database.urlFile).

Prometheus and OpenTelemetry

The Monitor Gradient guide covers setup, metric names and alert examples.

Hashing

Gradient computes SHA-256 hashes for NARs and cached files. Nix clients work without any experimental feature enabled. Uploads made earlier with blake3: hashes remain resolvable.