Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@ follow-web-links = false

# Redirecting because of typos and restructuring
"getting-startet-with-nix-flakes.html" = "getting-started-with-flakes.html"
"flakes.html" = "getting-started-with-flakes.html"
1 change: 0 additions & 1 deletion src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
- [Functions](functions.md)
- [`evalTerranixConfiguration`](eval-terranix-configuration.md)
- [Modules](modules.md)
- [terranix via nix flakes](flakes.md)

# News

Expand Down
119 changes: 0 additions & 119 deletions src/flakes.md

This file was deleted.

36 changes: 33 additions & 3 deletions src/getting-started-with-flakes.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,19 @@
[Nix flakes](https://nixos.wiki/wiki/Flakes)
make dependency management of modules and packages much easier.

Deeper look at terranix and nix flakes is done in the
[flake chapter](flakes.md).
## Quick start from template

The fastest way to get started is with the terranix flake template:

```shell
nix flake init --template github:terranix/terranix-examples
```

This creates a `flake.nix` and `config.nix` you can build right away.

## A minimal flake.nix

Extending [Getting started](./getting-started.md), this minimal flake your terranix resources are defined in `config.nix`:
Extending [Getting started](./getting-started.md), this minimal flake defines your terranix resources in `config.nix`:

```nix
{
Expand Down Expand Up @@ -98,3 +105,26 @@ You can create Nix flake _apps_ that let you run:
};
}
```

## Writing terranix modules

You can scaffold a new terranix module with:

```shell
nix flake init --template "github:terranix/terranix-examples#module"
```

A terranix module flake should provide the following outputs:

- `terranixModules.<name>` — individual modules
- `terranixModule` — all `terranixModules` combined

The function `lib.terranixOptions` can render an `options.json` for your module,
which is useful for generating documentation. See the
[terranix-module-github](https://github.com/terranix/terranix-module-github)
repository for an example.

For more on the module system itself, see the [Modules](modules.md) page.

As a next step, read [terranix and flake modules](./terranix-and-flake-modules.md)
to use flake-parts to manage terranix configurations declaratively
5 changes: 3 additions & 2 deletions src/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ config = mkAssert (cfg.parameter != "fail") "parameter is set to fail!" {
};
```

## provide terranix modules using nix flakes
## Provide terranix modules using nix flakes

Have a look at
[the flake documentation](flakes.md#writing-terranix-modules).
[Writing terranix modules](getting-started-with-flakes.md#writing-terranix-modules)
in the flakes documentation.
2 changes: 1 addition & 1 deletion src/news-2021-11-17_release-2.5.2.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ for your input on this release.
- add terranixOptionAst

Have a look at
[the flakes documentation](flakes.md#using-terranixconfigurationast-or-terranixconfigurationast)
[Evaluating terranix configurations](eval-terranix-configuration.md)
if you want to know how to use these functions.