Skip to content

Commit 5ee3e3c

Browse files
committed
docs: Fix documentation navigation and flakes tutorial
- Fix typo in URL (startet -> started) - Change casing in heading (Started -> started) - Add redirect for old typo filename to avoid broken links - Improve flakes tutorial slightly with example and references
1 parent d59dcc3 commit 5ee3e3c

File tree

4 files changed

+43
-17
lines changed

4 files changed

+43
-17
lines changed

book.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ enable = false
2323
follow-web-links = false
2424

2525
[output.html.redirect]
26+
# Redirecting because of brokenness when using subdirectories
2627
"documentation/flakes.html" = "../flakes.html"
2728
"documentation/functions.html" = "../functions.html"
2829
"documentation/getting-started.html" = "../getting-started.html"
@@ -43,3 +44,6 @@ follow-web-links = false
4344
"news/2023-09-22_release-2.7.0.html" = "../news-2023-09-22_release-2.7.0.html"
4445
"news/2024-10-15_release-2.8.0.html" = "../news-2024-10-15_release-2.8.0.html"
4546
"news/2025-11-09_website_renewal.html" = "../news-2025-11-09_website_renewal.html"
47+
48+
# Redirecting because of typos and restructuring
49+
"getting-startet-with-nix-flakes.html" = "getting-started-with-flakes.html"

src/SUMMARY.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
# Documentation
44

55
- [Introduction](index.md)
6-
- [Getting Started](getting-started.md)
6+
- [Getting started](getting-started.md)
77
- [What is Terraform / OpenTofu?](what-is-terranix.md)
8-
- [Getting Started with nix flake](getting-startet-with-nix-flakes.md)
9-
- [Differences between terranix and HCL](terranix-vs-hcl.md)
8+
- [Getting started with flakes](getting-started-with-flakes.md)
9+
- [Differences between terranix and HCL](terranix-vs-hcl.md)
1010
- [Functions](functions.md)
1111
- [Modules](modules.md)
1212
- [terranix via nix flakes](flakes.md)
Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
1-
[nix flakes](https://nixos.wiki/wiki/Flakes)
1+
# Getting started with flakes
2+
3+
[Nix flakes](https://nixos.wiki/wiki/Flakes)
24
make dependency management of modules and packages much easier.
35

46
Deeper look at terranix and nix flakes is done in the
5-
[flake chapter](flakes.md)
7+
[flake chapter](flakes.md).
68

7-
## nix build
9+
## A minimal flake.nix
810

9-
Here is a minimal `flake.nix`
11+
Extending [Getting started](./getting-started.md), this minimal flake your terranix resources are defined in `config.nix`:
1012

1113
```nix
1214
{
13-
inputs.terranix.url = "github:terranix/terranix";
15+
inputs = {
16+
terranix.url = "github:terranix/terranix";
17+
terranix.inputs.nixpkgs.follows = "nixpkgs";
18+
};
19+
1420
outputs = { terranix, ... }:
1521
let
1622
system = "x86_64-linux";
@@ -24,18 +30,34 @@ Here is a minimal `flake.nix`
2430
}
2531
```
2632

27-
You can run `nix build -o config.tf.json`, which should create a `config.tf.json`
28-
in your current folder.
29-
Now you are ready to run `terraform`.
33+
## nix build
34+
35+
Instead of `terranix config.nix > config.tf.json`, you can run `nix build -o config.tf.json`:
36+
37+
```
38+
nix build -o config.tf.json
39+
tofu init
40+
tofu apply
41+
```
42+
43+
Use terraform or tofu if you installed either of them plainly.
3044

3145
## nix run
3246

33-
Of course, you can use `apps` to do everything at once.
47+
You can create Nix flake _apps_ that let you run:
48+
49+
- `nix run`
50+
- `nix run .#apply`
51+
- `nix run .#destroy`
3452

3553
```nix
3654
{
37-
inputs.nixpkgs.url = "github:nixos/nixpkgs";
38-
inputs.terranix.url = "github:terranix/terranix";
55+
inputs = {
56+
nixpkgs.url = "github:nixos/nixpkgs";
57+
terranix.url = "github:terranix/terranix";
58+
terranix.inputs.nixpkgs.follows = "nixpkgs";
59+
};
60+
3961
outputs = { self, nixpkgs, terranix, ... }:
4062
let
4163
system = "x86_64-linux";
@@ -58,6 +80,7 @@ Of course, you can use `apps` to do everything at once.
5880
&& ${terraform}/bin/terraform apply
5981
'');
6082
};
83+
6184
# nix run ".#destroy"
6285
destroy = {
6386
type = "app";
@@ -69,10 +92,9 @@ Of course, you can use `apps` to do everything at once.
6992
'');
7093
};
7194
};
95+
7296
# nix run
7397
defaultApp.${system} = self.apps.${system}.apply;
7498
};
7599
}
76100
```
77-
78-
This provides you with the commands `nix run`, `nix run ".#apply"` and `nix run ".#destroy"`.

src/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Getting Started
1+
# Getting started
22

33
Let's have a quick overview on how you could use terranix.
44

0 commit comments

Comments
 (0)