First start: the setup assistant
The setup assistant opens on the first start when there are no saved settings
yet and there is no flake in /etc/nixos. You can open it again at any time
from Settings → Setup assistant….
It has three steps: Requirements, System and Import.
1. Requirements
The first step lists what the app needs: a system flake, a host already set up in it, and, for Home Manager settings, Home Manager imported as a NixOS module.
Meanwhile the app looks for system flakes (flakes that define
nixosConfigurations) in /etc/nixos, in the usual places in your home folder
and a few folder levels below it. If it finds none, it says so; you can still
choose the folder in the next step, or create a flake first, for example with
sudo nixos-generate-config --flake.
Click Next.
2. System
System flake
The flakes the scan found are listed under Found:. Pick one, type a path into Folder:, or click Browse… to choose the folder. Then click Use this flake. The app reads the hosts of the flake, which can take a moment.
Host
Choose the configuration of this machine under Host:. The host whose name matches this computer’s host name is preselected when there is one.
Folder for the generated files
This is where the app writes its files. It must be inside the flake, because a flake can only import files from its own folder.
- Leave the field empty to use the top folder of the flake. The settings are
then written to
drakeflake.nixnext toflake.nix; with a split layout, their parts go into adrakeflake/folder next to it. - Choose another folder (type it, or click Browse…) to keep the generated
files apart. With a split layout the settings are written to
default.nixin that folder with their parts next to it, so you import the folder itself; with the single-file layout they go intodrakeflake.nixin that folder.
If the folder does not exist yet, click Create folder.
File layout
Choose how the settings are split over files:
- Area and module: one file per area and module, for example
services/openssh.nixandnetworking/firewall.nix. - By area: one file per area, for example
services.nixandnetworking.nix. - Single file: everything in one file.
Packages you add go into packages.nix with the split layouts. You can change
the layout and add your own rules later in Settings.
Click Next.
3. Import
Your changes only take effect once your host configuration imports the generated file. This step shows the line to add, for example:
imports = [ ./drakeflake.nix ];
Add it to the configuration of your host, for example in its
configuration.nix. If the file already has an imports list, add the path to
that list. The path shown is relative to the top folder of the flake; if the
file that holds the import lives in a subfolder, adjust the path accordingly.
Then click Check import. The check:
- writes the generated file if it does not exist yet,
- adds it to git, because flakes only see tracked files,
- evaluates your host to see whether it really imports the file.
When the check succeeds you see “… imports the generated file. You are all set.” and can click Finish. If the host does not import the file yet, add the line, save the file and click Check import again.
You can also click Finish later and add the import afterwards. Until then the Changes page warns that your configuration does not import the file, and applying refuses to rebuild (Save only still works).