Usage with Flakes
Installation
colmena
is included in Nixpkgs beginning with 21.11.
For this tutorial, use the following command to enter an ephemeral environment with the colmena
command:
nix shell nixpkgs#colmena
If you are interested in trying out the bleeding-edge version of Colmena, Read the unstable version of the Manual for instructions.
Basic Configuration
Colmena reads the colmena
output in your Flake.
Here is a short example:
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = { nixpkgs, ... }: {
colmena = {
meta = {
nixpkgs = import nixpkgs {
system = "x86_64-linux";
};
};
host-a = { name, nodes, pkgs, ... }: {
boot.isContainer = true;
time.timeZone = nodes.host-b.config.time.timeZone;
};
host-b = {
deployment = {
targetHost = "somehost.tld";
targetPort = 1234;
targetUser = "luser";
};
boot.isContainer = true;
time.timeZone = "America/Los_Angeles";
};
};
};
}
The full set of deployment
options can be found here.
You can also check out the example in the main tutorial for some inspiration.
Now you are ready to use Colmena! To build the configuration:
colmena build
To build and deploy to all nodes:
colmena apply