My personal NixOS configuration for all of my machines.
This configuration is split into two parts:
- This repo, the public stuff;
- And a private repo, with
agenix
-encrypted secrets that I don't want to be public.
As a result, you can't just clone this configuration and run it.
You're welcome to use it as a reference for your own configuration, however I can't guarantee this is a perfect example.
There are several related repositories that contain additional customisations:
suckless
tools (my custom forks):- QMK firmware (for custom hardware-based keyboard layouts)
- Checkout the repo on the new machine.
- Run the following to switch the machine config to the minimal install and generate SSH host keys:
sudo nixos-rebuild switch --flake '.#_install'
- Backup the generated SSH host keys at
/etc/ssh/ssh_host_*
. - Run the following and copy the
ssh-ed25519
value it outputs. This is the public key for the host:ssh-keyscan localhost
- Add the public key to the private repository's
secrets.nix
file, add the system to the appropriate system groupings, and run the following:agenix --rekey
- Add a new entry to
flake.nix
with the new machine's name. - Create a new directory under
hosts
with the same name as you used in the step above. - Run
nixos-generate-config --show-hardware-config > hardware-configuration.nix
and puthardware-configuration.nix
in that directory. - In that directory, create a
default.nix
and configure it as necessary. - Run the following, where
<NEW_HOSTNAME>
is the new machine's name. After you've done it the first time, Nix will automatically use that hostname on subsequent rebuilds:sudo nixos-rebuild switch --flake '.#<NEW_HOSTNAME>'