machines/README.md
Kaare Hoff Skovgaard 1a3c10ea78
All checks were successful
/ dev-shell (push) Successful in 19s
/ terraform-providers (push) Successful in 11s
/ rust-packages (push) Successful in 24s
/ check (push) Successful in 43s
Fix another syntax error
2025-07-08 16:48:58 +02:00

49 lines
1.7 KiB
Markdown

# Nix Machines
This is my repository for all my various machines running NixOS (or Using Nix Darwin).
It has been created as an attempt at unifying all the various provisioning of software/cloud resources that must happen, such that for every instance there's a unified set of commands to run.
When running on a desktop machine, simply running `nixos-install` as per usual should suffice.
## Servers
To provision the cloud resources needed, the following can be run:
```bash
nix run '.#create-instance' -- <hostname>
```
This will run the `provision.pre` terraform code to ensure the cloud resources are created as needed, on either hetzner or openstack. It should also select the appropriate secrets backend to fetch secrets from. In general every server should use `vault` (OpenBAO) as the backend, except for the server hosting OpenBAO.
Once the instance has been created it will _not_ run NixOS, but rather something like Debian, which can then be provisioned into a NixOS installation. Run the following command to enroll NixOS on the instance:
```bash
nix run '.#inxos-install' -- <hostname>
```
<details>
<summary>NOTE</summary>
If you're creating and destroying instances on the same host name and have DNS caching trouble, you can run the following to connect using an IP address:
```bash
nix run '.#nixos-install' -- <hostname> <ip>
```
</details>
TODO: Here should be some guidance on how to transfer RoleID/SecretID to the server, as well as running the post provisioning scripts for the servers that need it.
To delete the resources again run:
```bash
nix run '.#destroy-instance' -- <hostname>
```
## Secrets
To transfer the secrets needed for OpenTofu from Bitwarden to OpenBAO run:
```bash
nix run '.#bitwarden-to-vault'
```