NixOS configuration for my homelab.
After flashing the base NixOS image to the nodes, some setup is required for this config to work:
- Change the
sshUser
tonixos
inflake.nix
. This is only required for the initial deploy, after that we'll use the root user with an ssh key. - Configure
sops-nix
with the node's public age keys.
# Get public age key on the node
sudo nix-shell -p ssh-to-age --run 'cat /etc/ssh/ssh_host_ed25519_key.pub | ssh-to-age'
# Update keys in `.sops.yaml`
# Re-encrypt files
nix-shell -p sops --run "sops updatekeys secrets/secrets.json"
- Make sure to include your public ssh keys in
./modules/common.nix
. - For k3s to work properly, you first need to deploy
node1
, retrieve the server token withcat /var/lib/rancher/k3s/server/token
and edit it in the secret file to make sure k3s agents can connect to the server.
Deploy the config:
nix run github:serokell/deploy-rs .
If you only want to deploy a certain node:
nix run github:serokell/deploy-rs .#node1