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

Configure a ChromeOS guest

Use nixos-crostini to connect a NixOS guest to ChromeOS. Follow these steps to select a module, configure the guest, and build an image.

1. Select a guest type

GuestModule to importOption reference
Baguette VMnixosModules.baguetteBaguette
LXC container in TerminanixosModules.crostiniCrostini

Import one module for your guest type.

2. Add the module to your flake

For a new configuration, start with the repository template. For an existing flake, follow the Baguette module example or the LXC module example.

Add the selected module to the modules list passed to nixpkgs.lib.nixosSystem. Keep your guest settings in your own NixOS configuration.

3. Select the ChromeOS account

Replace yourname with the username you use for Linux on ChromeOS:

users.users.yourname = {
  isNormalUser = true;
  crostini.enable = true;
};

Enable registration for one normal user. See the account option for the registration setting.

4. Set guest behavior

Use your guest’s option reference for types, defaults, and examples.

TaskDocumentation
Set Baguette image resourcesDisk size, build memory
Start Baguette with an ephemeral rootEphemeral root guide
Run Wayland applications without X11Baguette, LXC
Remove optional command-line toolsBaguette, LXC
Control host forwarding in BaguettePorts, notifications

For other NixOS settings, use the NixOS option search.

5. Validate, build, and start the guest

Check your configuration:

nix flake check --no-build

Then follow the Baguette image steps or the LXC container steps to build the image and start the guest on ChromeOS.

nixosModules.baguette

Download option data.

baguette.ephemeralRoot.enable

Start each boot with a fresh root filesystem. Store root changes in RAM. Boot the base image with vmc start --rootfs. Keep persistent data on a separate writable disk.

Type: boolean

Default:

false

Example:

true

Declared by:

baguette.ephemeralRoot.mountOptions

Set extra options for the first overlay mount. The guest mounts the overlay before systemd starts. Use this option instead of an fstab remount.

Type: list of string

Default:

[ ]

Example:

[
  "nosuid"
  "nodev"
]

Declared by:

baguette.ephemeralRoot.persistMachineId

Keep the machine ID in the state subvolume’s machine-id file. Generate the ID on the first boot. Copy the ID into /etc/machine-id before systemd starts. This option requires baguette.ephemeralRoot.enable.

Type: boolean

Default:

false

Example:

true

Declared by:

baguette.ephemeralRoot.stateMountPoint

Set the mount point for the persistent Btrfs state subvolume. Use bind mounts from this path to keep data between boots.

Type: string matching the pattern /.+

Default:

"/state"

Declared by:

baguette.ephemeralRoot.tmpfsSize

Set the size limit for the tmpfs that stores root changes. Use bytes, a unit such as M or G, or a percentage of RAM. Writes fail with ENOSPC when the tmpfs is full.

Type: string matching the pattern [1-9][0-9]*[kKmMgGtTpPeE%]?

Default:

"1G"

Declared by:

baguette.imageCompression.level

Set the zstd compression level of the base image.

Type: integer between 1 and 19 (both inclusive)

Default:

3

Declared by:

baguette.imageCompression.threads

Set the compression worker count. Use zero for all CPUs.

Type: unsigned integer, meaning >=0

Default:

0

Declared by:

baguette.notifications.enable

Send desktop notifications to ChromeOS.

Type: boolean

Default:

true

Example:

true

Declared by:

baguette.portListener.enable

Send guest listening ports to ChromeOS.

Type: boolean

Default:

true

Example:

true

Declared by:

crostini.extraTools.enable

Install xdg-utils, wl-clipboard, and usbutils.

Type: boolean

Default:

true

Example:

true

Declared by:

crostini.sommelier.stableScaling

Pass --stable-scaling to the X11 sommelier. This matches the ChromeOS setting. GTK 2 windows can increase in size after each resize.

Type: boolean

Default:

false

Example:

true

Declared by:

crostini.sommelier.xwayland.enable

Start Xwayland through the X11 sommelier instances. Set this option to false for Wayland applications that do not need X11. ChromeOS supplies the Xwayland executable on the tools disk.

Type: boolean

Default:

true

Example:

true

Declared by:

crostini.ui.enable

Use the ChromeOS GTK themes, icons, and cursors. ChromeOS supplies CrosAdapta for GTK 3 at /opt/google/cros-containers/cros-adapta. Use a flat style with GTK 2’s built-in theme.

Type: boolean

Default:

true

Example:

true

Declared by:

crostini.ui.adwaita

Set the package that supplies share/icons/Adwaita.

Type: package

Default:

pkgs.adwaita-icon-theme

Declared by:

users.users.<name>.crostini.enable

Register this user with ChromeOS. Enable this option for one normal user.

Type: boolean

Default:

false

Example:

true

Declared by:

virtualisation.buildMemorySize

Set the memory size of the image build VM in MiB.

Type: positive integer, meaning >0

Default:

1024

Declared by:

virtualisation.diskImageSize

Set the Btrfs image size in MiB.

Type: positive integer, meaning >0

Default:

4096

Declared by:

nixosModules.crostini

Download option data.

crostini.extraTools.enable

Install xdg-utils, wl-clipboard, and usbutils.

Type: boolean

Default:

true

Example:

true

Declared by:

crostini.sommelier.stableScaling

Pass --stable-scaling to the X11 sommelier. This matches the ChromeOS setting. GTK 2 windows can increase in size after each resize.

Type: boolean

Default:

false

Example:

true

Declared by:

crostini.sommelier.xwayland.enable

Start Xwayland through the X11 sommelier instances. Set this option to false for Wayland applications that do not need X11. ChromeOS supplies the Xwayland executable on the tools disk.

Type: boolean

Default:

true

Example:

true

Declared by:

crostini.ui.enable

Use the ChromeOS GTK themes, icons, and cursors. ChromeOS supplies CrosAdapta for GTK 3 at /opt/google/cros-containers/cros-adapta. Use a flat style with GTK 2’s built-in theme.

Type: boolean

Default:

true

Example:

true

Declared by:

crostini.ui.adwaita

Set the package that supplies share/icons/Adwaita.

Type: package

Default:

pkgs.adwaita-icon-theme

Declared by:

users.users.<name>.crostini.enable

Register this user with ChromeOS. Enable this option for one normal user.

Type: boolean

Default:

false

Example:

true

Declared by:

Baguette ephemeral root

Set baguette.ephemeralRoot.enable to true to use a read-only base and a separate writable state disk. Root changes use RAM. Leave this option disabled for a writable root and in-place NixOS upgrades.

Build the image after you enable this option:

nix build .#baguette-zimage

The baguette-zimage output contains baguette_rootfs.img.zst and baguette_state.img.zst. The base uses seekable zstd with 128 KiB frames. ChromeOS reads it directly. Copy both compressed files to a baguette folder in ChromeOS Downloads. Create a new VM with the required state disk size:

vmc create --vm-type BAGUETTE --size 15G \
  --source \
    /home/chronos/user/MyFiles/Downloads/baguette/baguette_state.img.zst \
  baguette
vmc start --vm-type BAGUETTE \
  --rootfs \
    /home/chronos/user/MyFiles/Downloads/baguette/baguette_rootfs.img.zst \
  baguette

Important: Use the full start command after each VM stop or ChromeOS login.

Limitations

  1. Do not launch the VM from the app launcher, which does not retain --rootfs; use it only after the VM starts.
  2. Guest root can make the state disk bootable. A start without --rootfs can then run code from that disk.
  3. Keep the base image outside folders shared with Linux.
  4. Back up the base image with the stopped state disk.
  5. Do not use ChromeOS disk resizing with this layout: ChromeOS assumes its state disk is /dev/vdb; this layout uses /dev/vdc. Instead, export the state disk, then re-import with the new size.