Skip to Content
Determinate NixDeterminate Nixd

Determinate Nixd

Determinate Nixd is a daemon for both Linux and macOS that makes your experience of installing and using Nix dramatically more smooth.

Determinate Nixd comes bundled with Determinate and doesn’t require any special setup beyond what’s covered in Getting started.

Enterprise certificate management (macOS)

Nix relies on TLS certificates to function. On macOS, Determinate Nixd automatically handles enterprise certificates.

On startup, the system’s Keychain certificates are exported for Nix. If the certificate store changes, you need to restart Determinate Nixd.

Managed garbage collection

Determinate Nixd automatically schedules and manages garbage collection for Nix, striving to:

  • Retain at least 30GB of disk space free to allow for system updates
  • Operate in a steady-state mode with between 5-20% disk space free

If your disk falls below 5% free, Determinate Nixd enters an “urgent” garbage collection mode to immediately free disk space.

Commands

Although Determinate Nixd is mostly meant to run in the background, it also enables you to perform some helpful tasks.

Log in to FlakeHub

To log in to FlakeHub using Determinate Nixd:

Log in to FlakeHub using Determinate Nixd
determinate-nixd login

By default, this logs in to FlakeHub using token authentication (the determinate-nixd login token command is equivalent). You need to generate a token in the FlakeHub UI to log in this way.

Determinate Nixd also enables you to use federated authentication based on OpenID Connect (OIDC) and JSON Web Tokens (JWTs) to log in to FlakeHub from a variety of platforms:

Log in via Amazon STS

To log in via Amazon STS:

Log in to FlakeHub on AWS
determinate-nixd login aws
Log in via Google Cloud Platform

To log in via Google Cloud Platform metadata identity:

Log in to FlakeHub on Google Cloud Platform
determinate-nixd login gcp \ --frn <full-resource-name>

For more information, see our dedicated guide to authenticating to FlakeHub with Google Cloud Platform.

Log in on GitHub Actions

To log in on GitHub Actions:

Log in to FlakeHub on GitHub Actions
determinate-nixd login github-actions
Log in on GitLab CI/CD

To log in on GitLab CI/CD:

Log in to FlakeHub on GitLab CI/CD
determinate-nixd login gitlab-pipeline \ --jwt-env-var FLAKEHUB_GITLAB_CI_TOKEN

The --jwt-env-var option enables you to specify the environment variable name that you’ve chosen for your GitLab-supplied JSON Web Token (make sure not to prefix the name with a $ as you may be used to doing). The example above would work for an authentication configuration like this:

job_logging_in_to_flakehub: id_tokens: FLAKEHUB_GITLAB_CI_TOKEN: aud: https://my-audience.dev

Check your login status

To show your current FlakeHub login status:

Display current authentication status
determinate-nixd status

This displays:

  • Whether you’re currently logged in
  • The FlakeHub user name under which you’re logged in
  • The FlakeHub organizations to which you are attached

Log out

To log out of FlakeHub:

Log out of current session
determinate-nixd auth logout

Fix incorrect hashes

If Determinate Nix encounters an incorrect hash (such as a cargoHash or vendorSha256) in a derivation, Determinate Nixd can automatically fix the incorrect hashes in the appropriate Nix files:

Fix incorrect hashes
determinate-nixd fix hashes

The command above goes through all incorrect hashes and prompts you to fix them; if you approve, it changes the files on disk. You can also make it fix hashes without prompting you, which can be useful in automated scenarios:

Fix incorrect hashes with auto-apply
determinate-nixd fix hashes \ --auto-apply

For more info, see our guide to automatically fixing hashes in GitHub Actions.

Bind your installation

Determinate Nixd allows users or system administrators to bind their installation to a specific FlakeHub customer.

Once this is done, future logins are validated against this binding—the user or one of the user’s organizations must match the bound customer name.

Bind Determinate Nixd installation
determinate-nixd auth bind my-organization

Once an installation has been bound, only root or an elevated admin may undo the binding.

Reset Determinate Nixd binding and authentication
sudo determinate-nixd auth reset

List device tokens

You can list non-expired device tokens using the determinate-nixd auth token device list command, specifying the organization using the --org / -o option:

List device tokens
determinate-nixd auth token device list \ --org my-org

You can limit the number of displayed tokens using the --limit / -l option:

List device tokens limiting the number of displayed tokens
determinate-nixd auth token device list \ --org my-org \ --limit 10

The output displays this information for each token:

  • UUID
  • Description
  • Expiration date
  • Issue date
  • Type

Generate device tokens

You can generate device tokens using the determinate-nixd auth token device create command, specifying the organization using the --org / -o option and a description for the token using the --description / -d option:

Generate a device token
determinate-nixd auth token device create \ --org my-org \ --description "Submarine #137"

This pipes the token to stdout.

Revoke device tokens

You can revoke device tokens using the determinate-nixd auth token device revoke command, specifying the organization using the --org / -o option and the token ID using the --token-id option:

Revoke a device token
determinate-nixd auth token device revoke \ --org my-org \ --token-id "174579a8-b247-4cde-9636-54383015eb3e"

Upgrade Nix

To upgrade Nix to the most recent version of Nix advised by Determinate Systems:

Upgrade to the most recent version of Determinate Nix
sudo determinate-nixd upgrade

Additionally, you may specify a target version to be installed:

Upgrade to a specific version of Determinate Nix
sudo determinate-nixd upgrade --version v3.6.2

You need to run this command with sudo, as in the example above.

At any time, you can run a version check to see if you need to upgrade.

Check your version

You can check which version of Determinate Nix you’re running using the version command:

Check which version of Determinate Nix you're running
determinate-nixd version

If you’re not on the latest version, Determinate Nixd provides upgrade instructions.

Initialize

To initialize Determinate Nix after system boot:

Initialize Determinate Nix after system boot
determinate-nixd init

To continue running the init command in perpetuity to keep the Nix store mounted:

Keep the Nix store mounted
determinate-nixd init \ --keep-mounted

File a bug report

To file a bug report for Determinate:

File a bug report
determinate-nixd bug "Some bug title"

Optionally, you can supply a longer description as the second argument:

Supply a description when filing a bug report
determinate-nixd bug "Some bug title" "Some longer description"

You can use the --advisory flag to indicate that the bug is meant only as an advisory rather than as a critical:

Label a bug report as an advisory
determinate-nixd bug "Some bug title" "Some longer description" \ --advisory

You can also attach specific files to the report using the --attach option:

Attach files to a bug report
determinate-nixd bug "Some bug title" "Some longer description" \ --attach ./flake.nix

Shell auto-completion

You can generate auto-completion scripts for various shells using the determinate-nixd completion command. Here’s an example:

Load auto-completion scripts for zsh
eval "$(determinate-nixd completion zsh)"

Scripts are available for these shells:

  • bash
  • elvish
  • fish
  • powershell
  • zsh

Configuring Determinate Nixd

You can modify the behavior of Determinate Nixd using the JSON configuration file located at /etc/determinate/config.json by default.

These parameters are available:

ParameterDescriptionOptionsDefault
garbageCollector.strategyThe garbage collection strategy used by Determinate Nixdautomatic (Determinate Nixd automatically collects garbage in the background)

disabled (no automatic garbage collection)
automatic
authentication.additionalNetrcSourcesA list of paths to netrc files that are combined by Determinate Nixd and used by Nix. These files must exist and not be in /nix/store or the daemon refuses to start.List of paths to files
builder.stateWhether the native Linux builder is enabled.enabled or disabledenabled
builder.memoryBytesHow much memory to allocate to the builder process (in bytes)8589934592 (8 GiB)
builder.cpuCountThe number of CPUs to allocate to the builder process1
telemetry.sentry.endpointThe Sentry endpoint for uploading crash reports. Set to null to disable crash reporting.Determinate Systems’ Sentry endpoint

Here’s an example configuration file:

/etc/determinate/config.json
{ "garbageCollector": { "strategy": "automatic" }, "authentication": { "additionalNetrcSources": [ "/etc/determinate/netrc.custom" ] }, "builder": { "state": "enabled", "memoryBytes": 8589934592, "cpuCount": 1 } }

The default for builder.cpuCount is 1 because it turns out that using more than one CPU with macOS’s Virtualization framework is generally slower than using one CPU. So although it may be tempting to try to speed up Linux builds on macOS by setting this to a higher value, we recommend leaving it at 1 unless you’re absolutely sure that increasing it improves performance on your system.

additionalNetrcSources

This option enables you to specify additional netrc files for use by Nix. Determinate Nixd combines these into a single effective netrc file after some brief validation:

  • Each file must contain only unique netrc entries (no duplicates across any of the files)
  • Each file must be a valid netrc file
  • Each file must not be accessed through the Nix store

Put another way, you can’t have /nix/store/...-my-netrc as an entry even if that file is a symlink to another path outside of the Nix store.

The netrc file created and managed by Determinate Nixd is world readable. This is currently required by Determinate Nix.

This configuration shows how you can use Nix to manage additionalNetrcSources:

flake.nix
{ environment.etc."determinate/config.json".text = '' { "authentication": { "additionalNetrcSources": [ "/etc/corporate-mdm/provisioned/standard-netrc" ] } } ''; }
Last updated on