mkdir machines/<name>
cd machines/<name>
nix flake init --template github:jackinloadup/nixos#machineThis creates:
configuration.nix- Main system configurationhardware-configuration.nix- Hardware/disk settingsmodules.nix- Module imports
Edit the generated files:
# Define machine type and modules to import
vim configuration.nix
# Define disk layout and hardware settings
vim hardware-configuration.nixGenerate a unique hostId (required for ZFS):
head -c4 /dev/urandom | od -A none -t x4Use the provision-secrets tool to generate all machine secrets.
# Enter secrets shell
nix develop .#secrets
# Generate all secrets at once
provision-secrets <name> --all --nebula-ip 10.101.0.X/24
# Or generate specific secrets
provision-secrets <name> --ssh # SSH host key only
provision-secrets <name> --wireguard # WireGuard keys only
provision-secrets <name> --nebula --nebula-ip 10.101.0.X/24 # Nebula cert only
# Or use interactive mode
provision-secrets <name>After generation:
- Add the SSH public key to
secrets.nix - Add the WireGuard public key to
modules/nixos/gumdrop/vpn.nixpeers - Run
ragenix --rekeyto re-encrypt all secrets with the new key
See docs/secrets.md for detailed secrets management.
# Boot target machine with NixOS ISO
# Set password and note IP address
# From existing machine:
nix run github:nix-community/nixos-anywhere -- \
--build-on local \
--flake .#<name> \
--disk-encryption-keys /tmp/disk.key /tmp/disk.key \
nixos@<target-ip># On target machine, format disk with disko
sudo nix run github:nix-community/disko -- --mode disko /tmp/disko-config.nix
# Install
sudo nixos-install --flake .#<name>NIX_SSHOPTS="-t" nixos-rebuild boot --flake .#<name> --target-host root@<hostname>The machine template creates these files:
{ inputs, ... }:
{
imports = [
inputs.self.nixosModules.default
./hardware-configuration.nix
];
machine = {
users = [ "lriutzel" ];
# ... other options
};
gumdrop = {
vpn.client.enable = true;
vpn.client.ip = "10.100.0.X/24";
nebula.client.enable = true;
nebula.client.ip = "10.101.0.X/24";
};
system.stateVersion = "25.11";
}{ inputs, ... }:
{
imports = [
inputs.disko.nixosModules.disko
../../profiles/disk-laptop-1.nix # Choose appropriate profile
];
disko.devices.disk.main.device = "/dev/nvme0n1";
networking.hostId = "abcd1234"; # Generate unique ID
}- docs/machines.md - Machine overview
- docs/profiles.md - Disk and hardware profiles
- docs/secrets.md - Secrets management