- config: This folder contains all configurations. It is organized into the following subdirectories:
- machines/personal-computers/: The entrypoints to desktop PCs.
- machines/servers/: The entrypoints to servers.
- profiles: Basic nixos module sets for virtual machines, physical machines, and PCs. These are imported into machine configurations to form a standard baseline for all my systems.
- modules: Nixos configuration modules which constitute the
profiles
. Any machine unique configuration should go in themachines/
folder for the specific machine in question.
- modules: Custom nixos and home-manager modules I use in my
config
. - installer: Custom nixos installer iso I use to quickly provision new machines.
- Create a machine profile in
config/machines
. Import a non-existent./hardware.nix
file. - Build a fresh boot disk:
nix build '.#nixos-iso'
- Boot the new machine off the iso.
- Generate a hardware config for the new machine:
ssh "root@${IP}" nixos-generate-config --no-filesystems --show-hardware-config > "config/machines/servers/${MACHINE}/hardware.nix"
- run the installer script:
./installer/install-server.sh
- Detach the boot disk and reboot.
You can use nixos-anywhere to provision a new phyiscal machine. Create a new machine under machines/personal-computers
or machines/servers
then boot your new machine with any linux boot disk that provides you ssh access to root
.
A custom nixos install disk can be build with nix build '.#nixos-iso'
. This ISO will include SSH public keys from config/modules/security/sshd/public-keys.nix
as authorizedKeys for root
.
Finally, run nix run '.#install-pc'
or nix run '.#install-server'
to provision the machine with nixos-anywhere
. The script will prompt for the machine name and IP address.
NOTE: If you don't use the installer ISO and wish to deploy with colmena
or provision with nixos-anywhere
then be sure to provide your root user with an authorized SSH key.
Once you have your machine provisioned you can use colmena apply --on $MACHINE
to deploy it.
Lastly, if you are deploying with colmena
then you will either need a DNS entry for your machine names or you will need to tweak the mkMachine
function and set the IP with deployment.targetHost.
Deployments are done with colmena:
Build all servers:
$ colmena apply --on @server
Build a specific server:
$ colmena apply --on @sower
Build all PCs:
$ colmena apply --on @pc