Generate the host configuration
The second phase generates a fresh, self-contained NixOS flake
repository for this one machine, and places it on the freshly mounted
target at /mnt/home/<user>/nixos.
This is a key idea in the sway-home design: sway-home itself holds no
per-host configuration. It is a shared library of NixOS modules. Each
machine you own gets its own small repo that depends on sway-home as a
pinned flake input and calls sway-home.lib.mkHost. That per-host repo
holds only this machine’s disko.nix (disk layout), hardware.nix
(detected hardware, no filesystems – disko owns those), and config.nix
(your overrides).
Run it from the menu, or directly:
setup host
Answer the prompts
== Generate a per-host NixOS config ==
? Hostname (nixos)
? Primary username
? Time zone (America/Denver)
? Select profiles to enable (space toggles, enter confirms; none = minimal server):
> [ ] dotfiles - Shell/CLI home environment (bashrc, ~/.config dotfiles, emacs, CLI tools) -- no GUI
[ ] sway - Sway desktop (greetd login, sway, fonts, firefox; implies dotfiles)
[ ] sound - PipeWire audio
[ ] podman - Podman containers (Docker-compatible)
[ ] flatpak - Flatpak + Flathub remote
[ ] libvirt - libvirt/KVM virtualization (the `vm` command, virt-manager)
- Hostname – the name of this machine (default
nixos). - Primary username – your login account (required).
- Time zone – an IANA time zone like
America/Denver. - Profiles – a multi-select of optional subsystems to switch on. Press
space to toggle each, enter to confirm. Selecting nothing gives a bare
minimalserver (sshd plus your user, no desktop);swayadds the full desktop. Whatever you pick is written intoconfig.nixas amy.profiles.<name>.enabletoggle, and the rest are left there as commented examples. Nothing here is permanent – you can enable or disable any profile later. See the Profiles chapter.
Review
The SSH public keys currently authorized on the ISO (the ones you
baked in when you built it) are seeded into the new config.nix, so
the installed machine stays reachable over SSH – sshd is key-only.
================ Review =================
Hostname: box
Username: ryan
Profiles: (none -- minimal server, sshd only)
Time zone: America/Denver
System: x86_64-linux
SSH keys: 1 (seeded from ISO)
sway-home: github:EnigmaCurry/sway-home
Host repo: /mnt/home/ryan/nixos
=========================================
? Generate this host config? (Y/n)
After you confirm, it:
- Detects the hardware with
nixos-generate-config --no-filesystems(disko owns the filesystems, so they are intentionally excluded). - Writes the repo:
flake.nix,config.nix,hardware.nix, a copy ofdisko.nixfrom the previous phase, aJustfile, and a.gitignore. - Runs
git init, resolves and pins sway-home intoflake.lock, and commits.
The repo is left root-owned for now; the Install phase fixes its ownership once your user account exists in the installed system.
If no SSH keys were found on the ISO, the review shows NONE FOUND and
you must add at least one key to config.nix before installing, or
you will be locked out of the headless machine after reboot (sshd is
key-only).