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

nixos-nspawn CLI reference

This is generated from the source code.

Usage:

nixos-nspawn [-h] [--unit-file-dir UNIT_FILE_DIR] [-v]
             {autostart,create,list,list-generations,remove,rollback,update} ...

NixOS imperative container manager v0.11.0

Positional arguments:

  • {autostart, create, list, list-generations, remove, rollback, update}: Command to execute

Optional arguments:

  • --unit-file-dir UNIT_FILE_DIR: Directory where Systemd nspawn container unit files are stored
  • -v, --verbose: Show build traces and other command activity

Usage of autostart:

nixos-nspawn autostart [-h] [--json] [-n]

Start all imperative containers on the system which are configured to start at boot time

Optional arguments of autostart:

  • --json: Output in JSON format
  • -n, --dry-run: Show which containers would be started

Usage of create:

nixos-nspawn create [-h] [--json] [--config CONFIG] [--profile PROFILE] [--flake FLAKE]
                    [--system SYSTEM] name

Create a container on the system

Positional arguments of create:

  • name: Container name

Optional arguments of create:

  • --json: Output in JSON format
  • --config CONFIG: Container configuration file
  • --profile PROFILE: Container system profile path
  • --flake FLAKE: Container configuration flake URL
  • --system SYSTEM: The host platform name. The default (x86_64-linux) is selected at compile time.

Usage of list:

nixos-nspawn list [-h] [--type {imperative,declarative}] [--json]

List containers on the system

Optional arguments of list:

  • --type {imperative,declarative}: Container type to filter by
  • --json: Output in JSON format

Usage of list-generations:

nixos-nspawn list-generations [-h] [--json] name

List configuration generations of a container

Positional arguments of list-generations:

  • name: Container name

Optional arguments of list-generations:

  • --json: Output in JSON format

Usage of remove:

nixos-nspawn remove [-h] [--delete-state] name

Remove a container from the system

Positional arguments of remove:

  • name: Container name

Optional arguments of remove:

  • --delete-state: Delete the container’s state directory

Usage of rollback:

nixos-nspawn rollback [-h] [--json] name

Roll back a container on the system

Positional arguments of rollback:

  • name: Container name

Optional arguments of rollback:

  • --json: Output in JSON format

Usage of update:

nixos-nspawn update [-h] [--json] [--config CONFIG] [--profile PROFILE] [--flake FLAKE]
                    [--strategy {reload,restart}] [--system SYSTEM] name

Update a container present on the system

Positional arguments of update:

  • name: Container name

Optional arguments of update:

  • --json: Output in JSON format
  • --config CONFIG: Container configuration file
  • --profile PROFILE: Container system profile path
  • --flake FLAKE: Container configuration flake path
  • --strategy {reload,restart}: Activation strategy to use to apply the update to the container. Leave blank to use strategy configured in the container’s configuration.
  • --system SYSTEM: The host platform name. The default (x86_64-linux) is selected at compile time.