Jump to
↵select↑↓navigateescclose

Reference

Scaffolder

The flags, modes and exit codes of wordpress-init, the program behind nix run github:Avunu/wordpress that creates, converts and reconciles Bedrock sites.

Updated
Tags
  • reference
  • wordpress-init
  • cli
  • scaffolding
On this page

nix run github:Avunu/wordpress runs wordpress-init, the scaffolder. Pass flags after --:

nix run github:Avunu/wordpress -- --migrate --dry-run

It never prompts when stdin or stdout is not a terminal, so scripted runs must pass what they need (-y to convert).

Usage: wordpress-init [options] [target-dir]

Mode

The mode comes from the target directory (the current directory when it holds a WordPress install or a site):

DirectoryMode
empty--init: a new Bedrock site
Bedrock plus a wordpress-nix flakereconcile (a no-op when nothing drifted)
classic WordPress (wp-includes/version.php, or plugins and themes under wp-content/)migrate
a v2 wordpress-nix site (its flake names Avunu/wordpress, code under wp-content/)migrate; the old flake goes to the backup
a foreign flake.nixexit 4 (--force writes flake.nix.wordpress-nix)
multisiteexit 6
FlagMeaning
--initForce scaffold mode. Needs an empty directory unless you add --force.
--migrateForce migration mode. Also reconciles a wordpress-nix site.
--syncWrite the site's managed files (wordpress-nix sync --write). With --migrate, after the conversion.
--checkReport drift in them and change nothing (wordpress-nix sync --check).
--forceRelax the mode guard. It never overwrites an existing file.
--dry-runPrint the plan and exit without changing anything.
-y, --yesAssume yes. Required to convert without a terminal.

Common

FlagMeaning
--version <x.y.z>The WordPress core version to pin (roots/wordpress). Overrides detection.
--name <slug>The site's slug. Defaults to the directory's name, without site-.
--home-url <url>The site's home URL: the --default-site equivalent. Defaults to the survey's or the dump's home.
--php <php83|php84|php85>The PHP the site builds with (wordpress-nix.site.php, config.platform.php). Default php84.
--skip-lockDo not run composer update, nix run .#relock or nix flake lock. nix/vendor-hash stays lib.fakeHash.
--strictTreat warnings as errors (exit 1).
--commit[=<msg>]Commit the result instead of only staging it.
-h, --helpShow the help.

Migration only

FlagMeaning
--survey <file>The legacy survey. Default: .wordpress-nix-backup/survey.json.
--dump <file>The legacy dump, read for the active set when there is no survey. Default: .wordpress-nix-backup/dump.sql.
--keep-plugin <slug>Keep a plugin the plan would drop, or resolve its db-code flag. Repeatable.
--drop-plugin <slug>Drop a plugin the plan would keep, or resolve its missing-code flag. Repeatable.
--keep-inactiveKeep inactive plugins and themes; also allows a run with no survey or dump.
--keep-saltsKeep the legacy salts (written to .wordpress-nix-backup/salts.env).
--accept-modified <slug>:<replace|vendor>A wordpress.org copy with local changes: replace it with the Composer package, or commit the modified copy. Repeatable.
--no-loosenWith --commit, skip the second commit that loosens plugin constraints to ^x.y.

The environment: WORDPRESS_NIX_CATALOG (a catalog file in place of wordpress.org, WP Packages and Packagist: offline runs and the tests) and WORDPRESS_NIX_DATA_DIR (the data files) only.

Exit codes

CodeMeaning
0Done, or --dry-run finished.
1A generic failure, --strict warnings, a blocked plan, or a failed lock step (composer update, relock, nix flake lock).
2--init into a directory that is not empty, without --force.
4A flake.nix that is not wordpress-nix's is in the way. --migrate --force writes the site flake to flake.nix.wordpress-nix to merge.
5The WordPress version is undetectable or below 6.6.
6The directory is not the shape the mode needs (not WordPress, multisite), you declined the confirmation, or there is no survey or dump to tell the active set.
7A WordPress skeleton with no code in it: nothing to migrate.
8The directory is inside another git repository. --force creates a nested one anyway.

The exit codes of --sync and --check are wordpress-nix sync's, the shared table frappe-nix documents: 0 clean, 1 drift, 2 invalid configuration (including a site that has not opted in), 3 environment. A usage error under them is 2, never 1.