Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Commands

The dmrg binary exposes five subcommands.

dmrg init

Creates the initial configuration files (index.ts and index.d.ts) in the target directory.

dmrg init [OPTIONS]
FlagDescription
-p, --path <PATH>Directory where the files will be created. Defaults to the current directory.
--overwriteOverwrite both files if they already exist.
--update-typesOnly update index.d.ts to the latest version, leaving index.ts untouched.

Examples:

# Initialize in the current directory
dmrg init

# Initialize in a specific directory
dmrg init --path ~/dotfiles

# Overwrite existing files
dmrg init --overwrite

# Update only the type definitions
dmrg init --update-types

--overwrite and --update-types cannot be used together.


dmrg apply

Evaluates the configuration, computes the diff against the last applied state, and applies the changes. A confirmation prompt is shown before applying unless --no-confirm is passed. The configuration is validated before any changes are applied, see Configuration → Validation for the rules.

dmrg apply --name <NAME> [--file <FILE> | --stdin] [OPTIONS]
FlagDescription
-f, --file <FILE>Path to the configuration file. Required unless --stdin is used.
-n, --name <NAME>Name of the configuration to apply.
-d, --dry-runPrint the list of changes without applying them. Sections with no pending changes are omitted from the output. Skips the confirmation prompt.
--no-confirmSkip the confirmation prompt and apply immediately.
--overwrite-symlinkAllow overwriting already existing dotfile symlinks.
--from-jsonParse the configuration as JSON (from file or stdin).
--from-yamlParse the configuration as YAML (from file or stdin).
--stdinRead the configuration from stdin instead of a file. Requires --from-json or --from-yaml.

Examples:

# Apply a TypeScript configuration
dmrg apply --file ~/dotfiles/index.ts --name desktop

# Preview changes without applying
dmrg apply --file ~/dotfiles/index.ts --name desktop --dry-run

# Apply without confirmation prompt
dmrg apply --file ~/dotfiles/index.ts --name desktop --no-confirm

# Apply and overwrite existing symlinks
dmrg apply --file ~/dotfiles/index.ts --name desktop --overwrite-symlink

# Apply from a JSON file
dmrg apply --file config.json --name desktop --from-json

# Apply from stdin (useful for piping from another program)
my-config-generator | dmrg apply --stdin --from-json --name desktop

Demiurge compares the desired configuration against the previously applied state and only performs the necessary changes:

SectionOn addOn remove
systemSets the hostname
packagesInstalls via the package managerRemoves via the package manager
servicessystemctl start + systemctl enablesystemctl stop + systemctl disable
usersusermod --append --groupsusermod --remove --groups
dotfilesCreates symlinksRemoves symlinks

After applying, the result is saved per subsystem: subsystems that succeeded advance to the new state so future runs skip them; subsystems that failed retain their previous state so future runs will retry them. If any subsystem failed the command exits with an error after saving.


dmrg eval

Evaluates the TypeScript configuration file and prints the resulting configuration. Useful for debugging or for exporting to JSON/YAML to be consumed by other tools or applied via stdin.

dmrg eval --file <FILE> [OPTIONS]
FlagDescription
-f, --file <FILE>Path to the TypeScript configuration file.
--jsonPrint the output in JSON format.
--yamlPrint the output in YAML format.

Examples:

# Print the parsed configuration as a Rust debug struct
dmrg eval --file ~/dotfiles/index.ts

# Export to JSON
dmrg eval --file ~/dotfiles/index.ts --json > config.json

# Export to YAML
dmrg eval --file ~/dotfiles/index.ts --yaml > config.yaml

# Pipe directly into apply
dmrg eval --file ~/dotfiles/index.ts --json | dmrg apply --stdin --from-json --name desktop

dmrg status

Displays the configuration that was last successfully applied, reading the persisted state from the data directory.

dmrg status

No options are available for this command.

Example output:

Applied Configuration
─────────────────────

System
  Hostname: my-machine

Packages
  cargo: ripgrep
  paru: git, vim

Dotfiles
  /home/alice/.dotfiles/nvim → /home/alice/.config/nvim

Services
  bluetooth, docker

Users
  alice: docker, wheel

If no configuration has been applied yet, the command prints an informational message and exits successfully:

No configuration has been applied yet.

dmrg schema

Prints the JSON Schema for the Demiurge configuration object. Useful for validating configurations or setting up editor schema support.

dmrg schema [OPTIONS]
FlagDescription
-o, --output <PATH>Directory where the schema will be saved as schema.json. Prints to stdout if omitted.

Examples:

# Print the schema to stdout
dmrg schema

# Save the schema to a directory
dmrg schema --output ~/dotfiles