devenv machines - #3073
Draft
domenkozar wants to merge 3 commits into
Draft
devenv machines#3073domenkozar wants to merge 3 commits into
domenkozar wants to merge 3 commits into
Conversation
Contributor
🔍 Suggested ReviewersBased on git blame analysis of the changed lines, the following contributors have significant experience with the modified code:
Please consider reviewing this PR as you have authored significant portions of the code being modified. Your expertise would be valuable! 🙏 This comment was automatically generated by git-blame-auto-reviewer Last updated: 2026-08-30T19:11:23.821Z |
Deploying devenv with
|
| Latest commit: |
06b2f4c
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://9e3731dc.devenv.pages.dev |
| Branch Preview URL: | https://feature-machines-secretspec.devenv.pages.dev |
domenkozar
force-pushed
the
feature/machines-secretspec
branch
3 times, most recently
from
August 22, 2026 15:23
5e6291a to
ed61d24
Compare
Add machine build targets, concurrent deploy/install orchestration, SecretSpec bootstrap support, remote builder integration, safety checks, documentation, and integration coverage.
domenkozar
force-pushed
the
feature/machines-secretspec
branch
from
August 30, 2026 19:11
341db4c to
90cd42f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
This introduces an experimental
machinesinterface for managing NixOS, nix-darwin, and home-manager configurations from the same devenv project that contains the development environment.Users can now:
The interface is documented as experimental so it can evolve based on real-world use.
Define, inspect, build, and deploy a machine
A machine lives in
devenv.nixand can contain one or more roles:Users can inspect or build it without connecting to the target:
Once the host is running, one command builds, copies, and activates its declared roles in the correct order:
$ devenv machines deploy webNixOS activates first and home-manager follows, so a system configuration can create a user before its home configuration is applied. nix-darwin uses the same model, while home-manager may also be activated locally by omitting
target.host.Running
devenv machines deploywithout names deploys all remote targets. Independent machines run in parallel, failures are collected into a final summary, and--max-concurrent Ncontrols rollout concurrency.Install a fresh NixOS host
With a disko layout declared under the NixOS module, devenv can provision a machine that only has SSH and a Linux kernel:
$ devenv machines install webThe install pipeline:
.machines/web/facter.json;Install always requires explicit machine names because it can wipe disks. Multiple named hosts may be installed together, and flags allow operators to select phases, stop after disko, skip reboot, or limit concurrency.
The generated facter report is intended to be committed, allowing teammates and CI to reproduce the machine closure without probing the live host.
Bootstrap runtime secret managers with SecretSpec
Runtime secrets should still be managed by tools such as sops-nix or agenix. This feature handles the initial credential those tools need on first boot.
Declare the SecretSpec entry normally:
Then map it to a file in the installed system:
Resolve on the operator's machine
This is the default. The selected SecretSpec provider resolves the value locally, and devenv streams only its bytes over authenticated SSH.
Resolved values are kept out of Nix evaluation, store paths, process arguments, and generated remote scripts. Transfers use private temporary files, byte-counted framing, strict modes, sync, and atomic rename. Installs carrying local payloads require a pre-trusted SSH host key and disable forwarding features.
This mode works well when an operator already has provider access and is intentionally provisioning a machine.
Resolve on the target
For environments where the operator's machine should never receive the provider credential or secret value:
In this mode, devenv sends a self-contained SecretSpec declaration manifest, not fetched values or provider credentials. The live installer resolves only the requested entries using credentials already available to that target—for example workload identity, instance metadata, or target-side SecretSpec configuration.
The resolver is the SecretSpec binary bundled with the same devenv release and built for the target architecture. Provider helper tools can be added to its private runtime with
extraPackages; they do not become global system packages.This preserves SecretSpec's provider freedom: manifests, aliases, profiles, references, scopes, validation policy, environment selection, and global target configuration continue to work normally. Provider and profile overrides are optional rather than imposed by devenv.
Other useful workflows
--use-machines-as-builderswhen the operator cannot build a target architecture locally.devenv build machines.<name>without deploying.Supporting inputs such as disko, nixos-facter, nix-darwin, and home-manager are lazy: users only need the inputs for roles they actually configure. The former
configurationsoption remains available through a rename compatibility module.Documentation
Adds a complete Machines guide covering:
The generated option reference includes the new machine configuration surface.
Validation
nix build .#devenv -Ldevenv 2.2.2+5016975exposes the new Machines CLI and bundled SecretSpec 0.17.1git diff --checkThe full workspace run currently encounters two pre-existing/unrelated test failures in unchanged files:
devenv-shell::status_line_cache_invalidates_for_state_width_and_spinner_changes, whose elapsed-time assertion can cross a millisecond boundary;devenv-tasks::concurrent_dynamic_starts_launch_each_process_and_oneshot_once, which passed on isolated rerun.