A simple, stateless NixOS deployment tool [maintainer=@zhaofengli, @stepbrobd, @NickCao]
A simple, stateless NixOS deployment tool [maintainer=@zhaofengli, @stepbrobd, @NickCao]
Colmena is a simple, stateless NixOS deployment tool modeled after NixOps and morph, written in Rust.
It's a thin wrapper over Nix commands like nix-instantiate and nix-copy-closure, and supports parallel deployment.
Now with 100% more flakes! See Tutorial with Flakes below.
$ colmena apply --on @tag-a
[INFO ] Enumerating nodes...
[INFO ] Selected 7 out of 45 hosts.
(...) ✅ 0s Build successful
sigma 7s copying path '/nix/store/h6qpk8rwm3dh3zsl1wlj1jharzf8aw9f-unit-haigha-agent.service' to 'ssh://[email protected]'...
theta ✅ 7s Activation successful
gamma 8s Starting...
alpha ✅ 1s Activation successful
epsilon 7s copying path '/nix/store/fhh4rfixny8b21l6jqzk7nqwxva5k20h-nixos-system-epsilon-20.09pre-git' to 'ssh://[email protected]'...
beta 7s removing obsolete file /boot/kernels/z28ayg10kpnlrz0s2qrb9pzv82lc20s2-initrd-linux-5.4.89-initrd
kappa ✅ 2s Activation successful
colmena is included in Nixpkgs beginning with 21.11.
Use the following command to enter a shell environment with the colmena command:
nix-shell -p colmenaTo install the latest development version to your user profile:
nix-env -if https://github.com/zhaofengli/colmena/tarball/mainAlternatively, if you have a local clone of the repo:
nix-env -if default.nixA public binary cache is available at https://colmena.cachix.org, courtesy of Cachix. This binary cache contains unstable versions of Colmena built by GitHub Actions.
See Tutorial with Flakes for usage with Nix Flakes.
Colmena should work with your existing NixOps and morph configurations with minimal modification.
Here is a sample hive.nix with two nodes, with some common configurations applied to both nodes:
…The full set of options can be found in the manual.
Run colmena build in the same directory to build the configuration, or do colmena apply to build and deploy it to all nodes.
To use with Nix Flakes, create outputs.colmenaHive in your flake.nix.
Here is a short example:
…The full set of options can be found in the manual.
Run colmena build in the same directory to build the configuration, or do colmena apply to build and deploy it to all nodes.
error: flake 'git+file:///path/to/flake' does not provide attribute 'packages.x86_64-linux.colmenaHive', 'legacyPackages.x86_64-linux.colmenaHive' or 'colmenaHive'
Colmena now uses nix eval to evaluate flakes.
Your flake needs to depend on Colmena itself as an input and expose a new output called colmenaHive:
{
inputs = {
+ # ADDED: Colmena input
+ colmena.url = "github:zhaofengli/colmena";
# ... Rest of configuration ...
};
outputs = { self, colmena, ... }: {
+ # ADDED: New colmenaHive output
+ colmenaHive = colmena.lib.makeHive self.outputs.colmena;
# Your existing colmena output
colmena = {
# ... Rest of configuration ...
};
};
}Read the Colmena Manual.
SSH_CONFIG_FILE: Path to a ssh_config fileColmena is available under the MIT License.
No open issues yet, or sync has not completed.