Skip to content

fix(setup): ensure a containers policy.json so podman load works in the dev-shell - #686

Merged
c-vigo merged 3 commits into
feature/625-nix-claude-migrationfrom
bugfix/685-nixos-podman-policy-json
Jun 24, 2026
Merged

c-vigo merged 3 commits into
feature/625-nix-claude-migrationfrom
bugfix/685-nixos-podman-policy-json

Conversation

@c-vigo

@c-vigo c-vigo commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

On a NixOS host that gets podman from the flake dev-shell (the intended #625 onboarding path) rather than the virtualisation.containers NixOS module, just build failed at podman load -i result because no signature-verification policy.json existed at ~/.config/containers/policy.json or /etc/containers/policy.json. nix build succeeded, but the image could not be loaded.

The onboarding gap: scripts/init.sh's advisory host check uses podman info, which does not require policy.json, so just init reported the runtime green and the failure only surfaced later at just build.

Root cause

podman's containers/image library requires a policy.json for podman load; this build exposes no --signature-policy flag and no env-var override, so the file must physically exist at one of the two lookup paths. The NixOS module normally installs /etc/containers/policy.json; a dev-shell-only host never receives it.

Fix

scripts/init.sh (Host Checks) now ensures the user-level ~/.config/containers/policy.json with the standard permissive default ({ "default": [ { "type": "insecureAcceptAnything" } ] }, the same content containers-common / the NixOS module ship) when neither lookup path has a policy. The write is:

  • idempotent — re-running reports the policy as present, no rewrite;
  • non-destructive — never overwrites a system or user policy;
  • out of --check — --check exits before Host Checks, so it stays read-only.

Documented in docs/NIX.md (new Host container runtime (policy.json) subsection) and recorded in CHANGELOG.md (auto-synced to the workspace changelog).

Testing

  • tests/bats/init.bats: 3 new structural assertions (policy.json wired, permissive default, system-path short-circuit) — added RED, now green; full suite passes (29/29).
  • Behavioral check (sandboxed HOME): first run writes valid JSON; second run is idempotent; an existing system policy short-circuits without creating a user file.
  • shellcheck scripts/init.sh passes; bash -n parses clean.

Closes #685

@c-vigo
c-vigo merged commit 5a2ec17 into feature/625-nix-claude-migration Jun 24, 2026
10 checks passed
@c-vigo
c-vigo deleted the bugfix/685-nixos-podman-policy-json branch June 24, 2026 14:02
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.

1 participant