chore: readme layout fix

This commit is contained in:
Xavier Morel
2025-10-23 19:40:39 +02:00
parent cc957061de
commit c542509c2f

View File

@@ -4,48 +4,49 @@ This repository allows to manage LXC containers on Proxmox.
It's supposed to be used from an host where `nixos-rebuild` is available. It's supposed to be used from an host where `nixos-rebuild` is available.
=> Uses `nix-community/generators` to build a LXC template with a base NixOS container - Uses `nix-community/generators` to build a LXC template with a base NixOS container
=> Uses `terranix` to build the infra definition and `opentofu` to deploy it on Proxmox - Uses `terranix` to build the infra definition and `opentofu` to deploy it on Proxmox
=> Uses `nixos-rebuild` to deploy the configuration on the container - Uses `nixos-rebuild` to deploy the configuration on the container
My main objective was to have a "light" definition for the containers and to be able to use Nix to factorize configuration. My main objective was to have a "light" definition for the containers and to be able to use Nix to factorize configuration.
# Usage # Usage
## Prepare the infra constants ## Prepare the infra constants
-> `cp infra/constants.nix.template infra/constants.nix` - `cp infra/constants.nix.template infra/constants.nix`
-> adapt `infra/constants.nix` to match your needs - adapt `infra/constants.nix` to match your needs
-> touch `infra/ips.nix` - touch `infra/ips.nix`
-> remove both these files from `.gitignore` and `git add` them. - remove both these files from `.gitignore` and `git add` them.
## Build NixOS template ## Build NixOS template
-> modify `infra/lxc-template.nix` as needed - modify `infra/lxc-template.nix` as needed
-> run `build-template` - run `build-template`
-> template available in `nixos-template/tarball/` - template available in `nixos-template/tarball/`
(.tar.xz to be uploaded to Proxmox) (.tar.xz to be uploaded to Proxmox)
TODO Script the Proxmox Template upload if possible. TODO Script the Proxmox Template upload if possible.
## Prepare Terraform ## Prepare Terraform
-> create a user/role etc on Proxmox (see [the provider documentation](https://registry.terraform.io/providers/Telmate/proxmox/latest/docs)) - create a user/role etc on Proxmox (see [the provider documentation](https://registry.terraform.io/providers/Telmate/proxmox/latest/docs))
-> `cp terraform.tfvars.example terraform.tfvars` - `cp terraform.tfvars.example terraform.tfvars`
-> edit `terraform.tfvars` to fill in values - edit `terraform.tfvars` to fill in values
-> adapt the terraform base config as needed in `infra/main.nix` - adapt the terraform base config as needed in `infra/main.nix`
-> run `tofu init` - run `tofu init`
## Adapt NixOS / Terraform modules building ## Adapt NixOS / Terraform modules building
-> edit `lib/containers.nix` to change how a container definition is translated to TF / NixOS config (in particular check the template name) - edit `lib/containers.nix` to change how a container definition is translated to TF / NixOS config (in particular check the template name)
## Create containers definitions ## Create containers definitions
-> `cp containers/lxc-cont.nix.template containers/lxc-#NAME#.nix` - `cp containers/lxc-cont.nix.template containers/lxc-#NAME#.nix`
-> edit `containers/lxc-#NAME#.nix` as needed - edit `containers/lxc-#NAME#.nix` as needed
-> run `build-terraform-json` - run `build-terraform-json`
-> run `tofu plan` and review the plan - run `tofu plan` and review the plan
-> run `tofu apply`, hopefully without errors - run `tofu apply`, hopefully without errors
-> run `deploy #NAME#` - run `deploy #NAME#`
## Update container ## Update container
-> edit `containers/lxc-#NAME#.nix` as needed - edit `containers/lxc-#NAME#.nix` as needed
-> if the container specs have changed, do all as above - if the container specs have changed, do all as above
-> otherwise you can just run `deploy #NAME#` - otherwise you can just run `deploy #NAME#`