Misterio77/nix-config - file structure
- Boot it up with NixOS (ideally with a modified liveCD so SSH already works). If SSH isn't set up, get a video/serial output from the server and set a password for the nixos user.
- Save the generated
ed25519SSH private/public key off of the server.
- Add a
nixosConfigurationsstanza for the new host:
qotom = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs; };
modules = [
./hosts/qotom
];
};- Add a basic folder structure for the host:
hosts/qotom
├── default.nix
├── hardware-configuration.nix
├── ssh_host_ed25519_key.pub
└── ssh_host_rsa_key.pub- Convert public ed25519 key into an age key
nix-shell -p ssh-to-age --run "ssh-to-age -i /etc/ssh/ssh_host_ed25519_key.pub"- Add public key to
.sops.yaml - Run
nixos-anywherewith the--copy-host-keysoption, which will preserve the SSH keys (if you don't do that, you'll lock yourself out)
nix run github:nix-community/nixos-anywhere -- --flake .#qotom --target-host [email protected] --copy-host-keys