|
3 | 3 | [Nix flakes](https://nixos.wiki/wiki/Flakes) |
4 | 4 | make dependency management of modules and packages much easier. |
5 | 5 |
|
6 | | -Deeper look at terranix and nix flakes is done in the |
7 | | -[flake chapter](flakes.md). |
| 6 | +## Quick start from template |
| 7 | + |
| 8 | +The fastest way to get started is with the terranix flake template: |
| 9 | + |
| 10 | +```shell |
| 11 | +nix flake init --template github:terranix/terranix-examples |
| 12 | +``` |
| 13 | + |
| 14 | +This creates a `flake.nix` and `config.nix` you can build right away. |
8 | 15 |
|
9 | 16 | ## A minimal flake.nix |
10 | 17 |
|
11 | | -Extending [Getting started](./getting-started.md), this minimal flake your terranix resources are defined in `config.nix`: |
| 18 | +Extending [Getting started](./getting-started.md), this minimal flake defines your terranix resources in `config.nix`: |
12 | 19 |
|
13 | 20 | ```nix |
14 | 21 | { |
@@ -98,3 +105,29 @@ You can create Nix flake _apps_ that let you run: |
98 | 105 | }; |
99 | 106 | } |
100 | 107 | ``` |
| 108 | + |
| 109 | +## Writing terranix modules |
| 110 | + |
| 111 | +You can scaffold a new terranix module with: |
| 112 | + |
| 113 | +```shell |
| 114 | +nix flake init --template "github:terranix/terranix-examples#module" |
| 115 | +``` |
| 116 | + |
| 117 | +A terranix module flake should provide the following outputs: |
| 118 | + |
| 119 | +- `terranixModules.<name>` — individual modules |
| 120 | +- `terranixModule` — all `terranixModules` combined |
| 121 | + |
| 122 | +The function `lib.terranixOptions` can render an `options.json` for your module, |
| 123 | +which is useful for generating documentation. See the |
| 124 | +[terranix-module-github](https://github.com/terranix/terranix-module-github) |
| 125 | +repository for an example. |
| 126 | + |
| 127 | +For more on the module system itself, see the [Modules](modules.md) page. |
| 128 | + |
| 129 | +## Next steps |
| 130 | + |
| 131 | +- [terranix and flake modules](terranix-and-flake-modules.md) — use flake-parts to manage terranix configurations declaratively |
| 132 | +- [Evaluating terranix configurations](eval-terranix-configuration.md) — inspect your Terraform configuration in `nix repl` |
| 133 | +- [Customizing the Terraform binary](terraform-wrapper.md) — use OpenTofu, bundle plugins, or inject secrets |
0 commit comments