A simple, stateless NixOS deployment tool [maintainer=@zhaofengli, @stepbrobd, @NickCao]
A simple, stateless NixOS deployment tool [maintainer=@zhaofengli, @stepbrobd, @NickCao]
$ 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## Installation `colmena` is included in Nixpkgs beginning with 21.11. Use the following command to enter a shell environment with the `colmena` command: ```bash nix-shell -p colmena ``` ### Unstable Version To install the latest development version to your user profile: ```bash nix-env -if https://github.com/zhaofengli/colmena/tarball/main ``` Alternatively, if you have a local clone of the repo: ```bash nix-env -if default.nix ``` A 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](https://github.com/zhaofengli/colmena/actions). ## Tutorial *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](https://colmena.cli.rs/unstable/reference). Run `colmena build` in the same directory to build the configuration, or do `colmena apply` to build and deploy it to all nodes. ## Tutorial with Flakes 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](https://colmena.cli.rs/unstable/reference). Run `colmena build` in the same directory to build the configuration, or do `colmena apply` to build and deploy it to all nodes. ### Migrating to Direct Flake Evaluation > 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`: ```diff { 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 ... }; }; } ``` ## Manual Read [the Colmena Manual](https://colmena.cli.rs). ## Environment Variables - `SSH_CONFIG_FILE`: Path to a `ssh_config` file ## Current Limitations - It's required to use SSH keys to log into the remote hosts, and interactive authentication will not work. - Error reporting is lacking. ## Licensing Colmena is available under the MIT License.
暂无开放 Issues,或尚未同步最近议题。