NixOS generate is a flake output which allows generating different target formats from NixOS configurations.
The output type is implemented in nixos-generators which documents the available formats.
On the flake create screen, enter an appropriate name, then click "create".
You should now see the name of your flake in the flake selector to the upper right on your screen.
A flake is a software configuration unit specific to the language Nix.
Each flake has a set of inputs and outputs. The NixOS generate will describe an output in your flake. Note that your flake can have many outputs of different types at the same time. The inputs of your flake are locked to exact versions when you release your flake, which makes your configuration reproducible.
x86_64-linuxas the system and
virtualboxas the format.
Your NixOS generate should now be shown as an output in the flake output screen.
As part of our configuration, we will add the following settings to the NixOS generate:
truefor the key
nixosfor the key
nyancatpackage to the configuration.
nyancatavailable as a system package in our configuration.
Never configure sensitive passwords in plaintext.
Instead, use the users.users.<name>.hashedPassword option with a hash of a password with sufficient entropy.
After completing our flake configuration, we can now create the NixOS generate artifact.
To run the VirtualBox artifact created in this example, perform the following:
Congratulations! You are now running a NixOS generate that you have built!
To celebrate, run the
nyancat command from your virtual machine terminal.
NixOS generate configuration units may import NixOS modules and Home Manager configurations (see Imports).
NixOS settings may also be directly assigned to NixOS generate outputs (see Options).
It is recommended to use NixOS modules for configuration, then import this module to your NixOS generate output.