machines/README.md

44 lines
1.4 KiB
Markdown
Raw Normal View History

2025-07-08 16:46:13 +02:00
# 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, and install NixOS, the following can be run:
2025-07-08 16:46:13 +02:00
```bash
2025-07-08 16:47:32 +02:00
nix run '.#create-instance' -- <hostname>
2025-07-08 16:46:13 +02:00
```
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. Then it will install NixOS.
2025-07-08 16:46:13 +02:00
When making changes to eg. the approle needed, and needing to provision the instance again (but not installing NixOS again, as that won't work), run:
2025-07-08 16:46:13 +02:00
```bash
nix run '.#provision-instance' -- <hostname>
2025-07-08 16:46:13 +02:00
```
To update the NixOS config on an instance:
2025-07-08 16:46:13 +02:00
```bash
nix run '.#update-instance` -- <hostname>
2025-07-08 16:46:13 +02:00
```
To delete the resources again run:
```bash
nix run '.#destroy-instance' -- <hostname>
```
## Secrets
To transfer the secrets needed for OpenTofu from Bitwarden to OpenBAO/Vault run:
2025-07-08 16:46:13 +02:00
```bash
2025-07-08 16:48:58 +02:00
nix run '.#bitwarden-to-vault'
2025-07-08 16:46:13 +02:00
```