docs/site: update declarative setups documentation

This commit is contained in:
Gabriel Arazas 2023-12-23 20:32:08 +08:00
parent 14af688215
commit 18c7d5db35
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC
2 changed files with 55 additions and 39 deletions

View File

@ -4,8 +4,8 @@ title: Declarative host management
= Declarative host management
This project uses a custom setup for declarative host management.
Specifically, it is done with a simple file at github:{github-repo}[`./images.toml`, path=./images.toml, rev=master] where it expects a table of the hosts' metadata.
Each host in the table represents one of the hosts at github:{github-repo}[`./hosts/`, path=./hosts/, rev=master].
Specifically, it is done with a simple file at github:{github-repo}[`./setups/nixos.nix`, path=./setups/nixos.nix, rev=master] where it expects an attribute set of the hosts' metadata.
Each host in the set represents one of the hosts at github:{github-repo}[`./hosts/`, path=./hosts/, rev=master].
Each of declared hosts are then exported as part of the `images` flake output attribute where each is a derivation for building them as an image output.
For example, you can build my personalized NixOS installer ISO with the following command.
@ -19,26 +19,30 @@ A host metadata has a certain schema which the following example is a complete v
The data is then used for certain functions in the flake definition file (i.e., `flake.nix`).
[#lst:images-metadata-example]
[source, toml]
[source, nix]
----
[plover]
systems = [
"aarch64-linux",
"x86_64-linux",
]
format = "iso"
hostname = "ploverrific"
domain = "foodogsquared.one"
nixpkgs-channel = "nixos-unstable-small"
home-manager-channel = "home-manager-unstable"
[plover.deploy]
hostname = "plover.foodogsquared.one"
ssh-user = "admin"
fast-connection = true
auto-rollback = true
magic-rollback = true
remote-build = true
{
plover = {
systems = [ "x86_64-linux" "aarch64-linux" ];
format = "iso";
domain = "foodogsquared.one";
nixpkgs-channel = "nixos-unstable-small";
home-manager-channel = "home-manager-unstable";
modules = [
({ config, lib, ... }: {
services.foo.enable = true;
})
];
deploy = {
hostname = "plover.foodogsquared.one";
ssh-user = "admin";
fast-connection = true;
auto-rollback = true;
magic-rollback = true;
remote-build = true;
};
};
}
----
For a complete reference, here are the expected attributes.
@ -64,6 +68,8 @@ By default, it uses `nixpkgs` flake input which points to the `nixos-unstable` c
The value could be any one of the home-manager flake inputs imported into this flake.
By default, it uses `home-manager` flake input which follows the `home-manager-unstable` channel.
- `modules` is an extra list of modules to be imported with the configuration.
- `deploy` is a table containing arguments from github:serokell/deploy-rs[opts=repo].
Only a few arguments are accepted (i.e., `hostname`, `fast-connection`, `remote-build`, `magic-rollback`, and `auto-rollback`).

View File

@ -4,31 +4,39 @@ title: Declarative user management
= Declarative user management
Similarly to xref:../01-declarative-host-management/index.adoc[Declarative host management], this project also provides a way to declare home-manager users.
The `users.toml` sits in the project root expecting certain data.
Similar to `images.toml`, it expects a table of users with each representing one of the users from github:{github-repo}[`./users/home-manager/`, path=./users/home-manager/, rev=master].
The `./setups/home-manager.nix` sits in the project root expecting certain data.
Similar to the declarative NixOS setup, it expects an attribute set of users with each representing one of the users from github:{github-repo}[`./users/home-manager/`, path=./users/home-manager/, rev=master].
These are then included as part of `homeConfigurations` for easier installation with the standalone home-manager tool.
Of which they are then included as part of deploy nodes for deploy-rs (also for easier deployment).
Here's an example user with complete schema.
.A user with complete schema
[source, toml]
[source, nix]
----
[foo-dogsquared]
systems = [ "x86_64-linux" ]
nixpkgs-channel = "nixos-stable"
home-manager-channel = "home-manager-23.05"
home-directory = "/home/foo-dogsquared"
username = "foodogsquared"
[foo-dogsquared.deploy]
hostname = "local.foodogsquared.one"
ssh-user = "admin"
profile = "foodogsquared"
fast-connection = true
auto-rollback = true
magic-rollback = true
remote-build = true
{
foo-dogsquared = {
systems = [ "x86_64-linux" ];
nixpkgs-channel = "nixos-stable";
home-manager-channel = "home-manager-23.05";
home-directory = "/home/foo-dogsquared";
username = "foodogsquared";
modules = [
({ config, lib, ... }: {
services.foo.enable = true;
})
];
deploy = {
hostname = "local.foodogsquared.one";
ssh-user = "admin";
profile = "foodogsquared";
fast-connection = true;
auto-rollback = true;
magic-rollback = true;
remote-build = true;
};
};
}
----
- `systems` contains a list of platforms of the home-manager user.
@ -49,4 +57,6 @@ By default, it will be set at `/home/$USERNAME`.
If unset, it will use the table key.
In the above example, the unset value would be `foo-dogsquared`.
- `modules` is an extra list of modules to be imported with the configuration.
- `deploy` is pretty similar to the previous configuration setting that it sets certain options for deploy-rs.