Skip to content

NixOS: agent.yaml can be declared, not registered - #549

Draft
joshdrake wants to merge 1 commit into
mainfrom
docs/nixos-immutable-config
Draft

NixOS: agent.yaml can be declared, not registered#549
joshdrake wants to merge 1 commit into
mainfrom
docs/nixos-immutable-config

Conversation

@joshdrake

Copy link
Copy Markdown
Contributor

Refs OFF-19.

Merge after smallstep/agent#1205 — that PR is what updates the step-agent.nix published to files.smallstep.com, which these instructions tell readers to download.

Why

The NixOS section told readers not to manage agent.yaml with environment.etc, because "that produces a read-only symlink into the Nix store, and the service refuses to start." The diagnosis was wrong, and the advice ruled out the deployment NixOS users actually want — a customer raised exactly this while packaging the module for nixpkgs (NixOS/nixpkgs#555971).

Neither the symlink nor the file mode was the problem. The unit gated on ConditionPathIsReadWrite=, which per systemd.unit(5) tests whether the underlying filesystem is mounted read-only — not whether the file is writable — and it resolves symlinks. NixOS remounts /nix/store read-only at boot, so the check landed there and skipped the unit. The agent itself reads a mode 0444 agent.yaml without complaint and never writes to it; everything it writes lives in /var/lib/step-agent.

agent#1205 changes that gate to ConditionPathExists=, the question the unit meant to ask all along.

Changes

  • platform/smallstep-agent.mdx — replace the prohibition with the declarative form, wired to the existing Pre-registration via API section, which is already where the team slug and agent CA fingerprint come from. The interactive step-agent register path is unchanged and still documented first.
  • platform/troubleshooting-agent.mdx — update the "unmet condition check" callout to the new directive name, and note that older agents report the same check under the old one, so the message matches whichever version a reader has installed.

Checks

vale run against both files before and after (via the markdown parser — mdx2vast isn't installed locally): no new alerts. Anchor #pre-registration-via-api resolves to the existing ### Pre-registration via API heading in the same file.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RkEcowtxSeqvb2pLWC3u5J

The NixOS instructions told readers not to manage agent.yaml with
environment.etc, on the grounds that it "produces a read-only symlink into
the Nix store, and the service refuses to start". The diagnosis was wrong
and the advice ruled out the deployment NixOS users actually want.

Neither the symlink nor the file mode was the problem. The unit gated on
ConditionPathIsReadWrite=, which per systemd.unit(5) tests whether the
underlying filesystem is mounted read-only, not whether the file is
writable, and it resolves symlinks. NixOS remounts /nix/store read-only at
boot, so the check landed there and skipped the unit. The agent itself
reads a mode 0444 agent.yaml happily and never writes to it; everything it
writes lives in /var/lib/step-agent.

agent#1205 changes that gate to ConditionPathExists=, which is the question
the unit meant to ask all along. So point readers at the declarative form
instead, wired to the pre-registration flow that already documents where
the team slug and CA fingerprint come from.

Also refresh the troubleshooting callout for the new directive name, and
say that older agents report the same check under the old one, so the
message matches whichever version a reader has installed.

Merge after agent#1205, which is what updates the step-agent.nix published
to files.smallstep.com.

Refs OFF-19.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RkEcowtxSeqvb2pLWC3u5J
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants