On a machine with Nix and nixos-generate:
nixos-generate -f lxc
nixos-generate -f lxc-metadata
Copy the files generated to the ChromeOS device.
Open crosh
crosh> vsh termina
(termina) chronos@localhost ~ $ lxc image import /mnt/shared/MyFiles/Downloads/nixos-system-metadata.tar.xz /mnt/shared/MyFiles/Downloads/nixos-system.tar.xz --alias=nixos
(termina) chronos@localhost ~ $ lxc launch nixos nix
At this time, the LXC container does not show up in the terminal. To enter the container use the following commands in crosh
crosh> vsh termina
(termina) chronos@localhost ~ $ lxc list
(termina) chronos@localhost ~ $ lxc console nix
If the container is not running, run lxc start nix
to start the container
(termina) chronos@localhost ~ $ lxc start nix
Need to look into the Crostini Container Guest Utilities and having them embedded in the NixOS image as well as configuration for running inside of a LXC container.