Introduction

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.

Interested? Get started here!

$ 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://root@sigma.redacted'... 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://root@epsilon.redacted'... beta 🕗 7s removing obsolete file /boot/kernels/z28ayg10kpnlrz0s2qrb9pzv82lc20s2-initrd-linux-5.4.89-initrd kappa ✅ 2s Activation successful

You are currently reading version 0.2 of the Colmena Manual, built against version 0.2.2.

Tutorial

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 -p 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

If you use Nix Flakes, follow the Flake version here.

Colmena should work with your existing NixOps and morph configurations with minimal modification (see Migrating from NixOps/morph).

Here is a sample hive.nix with two nodes, with some common configurations applied to both nodes:

{
  meta = {
    # Override to pin the Nixpkgs version (recommended). This option
    # accepts one of the following:
    # - A path to a Nixpkgs checkout
    # - The Nixpkgs lambda (e.g., import <nixpkgs>)
    # - An initialized Nixpkgs attribute set
    nixpkgs = <nixpkgs>;

    # You can also override Nixpkgs by node!
    nodeNixpkgs = {
      node-b = ./another-nixos-checkout;
    };

    # If your Colmena host has nix configured to allow for remote builds
    # (for nix-daemon, your user being included in trusted-users)
    # you can set a machines file that will be passed to the underlying
    # nix-store command during derivation realization as a builders option.
    # For example, if you support multiple orginizations each with their own
    # build machine(s) you can ensure that builds only take place on your
    # local machine and/or the machines specified in this file.
    # machinesFile = ./machines.client-a;
  };

  defaults = { pkgs, ... }: {
    # This module will be imported by all hosts
    environment.systemPackages = with pkgs; [
      vim wget curl
    ];

    # By default, Colmena will replace unknown remote profile
    # (unknown means the profile isn't in the nix store on the
    # host running Colmena) during apply (with the default goal,
    # boot, and switch).
    # If you share a hive with others, or use multiple machines,
    # and are not careful to always commit/push/pull changes
    # you can accidentaly overwrite a remote profile so in those
    # scenarios you might want to change this default to false. 
    # deployment.replaceUnknownProfiles = true;
  };

  host-a = { name, nodes, ... }: {
    # The name and nodes parameters are supported in Colmena,
    # allowing you to reference configurations in other nodes.
    networking.hostName = name;
    time.timeZone = nodes.host-b.config.time.timeZone;

    boot.loader.grub.device = "/dev/sda";
    fileSystems."/" = {
      device = "/dev/sda1";
      fsType = "ext4";
    };
  };

  host-b = {
    # Like NixOps and Morph, Colmena will attempt to connect to
    # the remote host using the attribute name by default. You
    # can override it like:
    deployment.targetHost = "host-b.mydomain.tld";

    # It's also possible to override the target SSH port.
    # For further customization, use the SSH_CONFIG_FILE
    # environment variable to specify a ssh_config file.
    deployment.targetPort = 1234;

    # Override the default for this target host
    deployment.replaceUnknownProfiles = false;

    # You can filter hosts by tags with --on @tag-a,@tag-b.
    # In this example, you can deploy to hosts with the "web" tag using:
    #    colmena apply --on @web
    # You can use globs in tag matching as well:
    #    colmena apply --on '@infra-*'
    deployment.tags = [ "web" "infra-lax" ];

    time.timeZone = "America/Los_Angeles";

    boot.loader.grub.device = "/dev/sda";
    fileSystems."/" = {
      device = "/dev/sda1";
      fsType = "ext4";
    };
  };
}

The full set of deployment options can be found here.

Now you are ready to use Colmena! To build the configuration:

colmena build

To build and deploy to all nodes:

colmena apply

Next Steps

  • Head to the Features section to see what else Colmena can do.
  • Read more about options available in Colmena in the Reference section.

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

Next Steps

  • Head to the Features section to see what else Colmena can do.
  • Read more about options available in Colmena in the Reference section.

Migrating from NixOps/morph

Colmena should work with existing NixOps and morph configurations with minimal modification. That said, there are a few things to look out for:

Colmena deploys to existing NixOS hosts

Unlike NixOps which can be configured to manage the entire lifecycles of NixOS machines (e.g., spinning up AWS EC2 instances), Colmena can only deploy to hosts already running NixOS.

network vs meta

Colmena accepts a set of options to configure the deployment itself as meta. For NixOps compatibility, it also accepts network as an alias so you don't have to change your existing configuration.

Pinning Nixpkgs

You can pin the nixpkgs version by setting meta.nixpkgs (or network.nixpkgs if you use the alias). This is required if you use Flakes. The options accepts one of the following:

  • Path to a Nixpkgs checkout (not supported in Flakes)
    • Example: ./nixpkgs
  • The Nixpkgs lambda returned by importing its default.nix (not supported in Flakes)
    • Example: import ./nixpkgs
  • A fully initialized Nixpkgs attribute set
    • Example: import ./nixpkgs { system = "x86_64-linux"; }

Features

This section introduces the main features in Colmena:

  • Node Tagging - Deploying to a subset of tagged nodes
  • Local Deployment - Deploying to the host running Colmena itself
  • Secrets - Deploying sensitive files separate from the main configuration
  • Ad Hoc Evaluation - Evaluating a Nix expression with access to your configuration
  • Parallelism - Controlling how Colmena parallelizes the deployment process

Node Tagging

With node tags, you can quickly select a subset of nodes for deployment. You can specify tags using the deployment.tags option:

{
  alpha = { pkgs, ... }: {
    deployment.tags = [ "web" "infra-lax" ];

    # ... Rest of configuration ...
  };
  beta = { pkgs, ... }: {
    deployment.tags = [ "infra-sfo" ];

    # ... Rest of configuration ...
  };
}

You can filter hosts by tags or names with --on, which accepts a comma-separated list of node names or @tags.

To select all nodes with web:

$ colmena apply --on @web

Wildcards are supported as well. To select all nodes with a tag beginning with infra-:

$ colmena apply --on '@infra-*'

(Note the quotes around the argument)

Local Deployment

For some machines, you may still want to stick with the manual nixos-rebuild-type of workflow. Colmena allows you to build and activate configurations on the host running Colmena itself, provided that:

  1. The node must be running NixOS.
  2. The node must have deployment.allowLocalDeployment set to true.
  3. The node's attribute name must match the hostname of the machine.

If you invoke apply-local with --sudo, Colmena will attempt to elevate privileges with sudo if it's not run as root. You may also find it helpful to set deployment.targetHost to null if you don't intend to deploy to the host via SSH.

As an example, the following hive.nix includes a node (laptop) that is meant to be only deployed with apply-local:

{
  meta = {
    nixpkgs = ./deps/nixpkgs-stable;

    # I'd like to use the unstable version of Nixpkgs on
    # my desktop machines.
    nodeNixpkgs = {
      laptop = ./deps/nixpkgs-unstable;
    };
  };

  # This attribute name must match the output of `hostname` on your machine
  laptop = { name, nodes, ... }: {
    networking.hostName = "laptop";

    deployment = {
      # Allow local deployment with `colmena apply-local`
      allowLocalDeployment = true;

      # Disable SSH deployment. This node will be skipped in a
      # normal`colmena apply`.
      targetHost = null;
    };

    # ... Rest of configuration ...
  };

  server-a = { pkgs, ... }: {
    # This node will use the default Nixpkgs checkout specified
    # in `meta.nixpkgs`.

    # ... Rest of configuration ...
  };
}

On laptop, run colmena apply-local --sudo to activate the configuration.

Secrets

Colmena allows you to upload secret files that will not be stored in the Nix store to nodes. It implements a subset of the deployment.keys options supported by NixOps.

For example, to deploy DNS-01 credentials for use with security.acme:

{
  shared-box = {
    security.acme.certs."my-site.tld".credentialsFile = "/run/keys/acme-credentials.secret";
    deployment.keys."acme-credentials.secret" = {
      # Alternatively, `text` (string) or `keyFile` (path to file)
      # may be specified.
      keyCommand = [ "vault" "read" "-field=env" "secret/dns01" ];

      destDir = "/run/keys";       # Default: /run/keys
      user = "acme";               # Default: root
      group = "nginx";             # Default: root
      permissions = "0640";        # Default: 0600

      uploadAt = "pre-activation"; # Default: pre-activation, Alternative: post-activation
    };
    # Rest of configuration...
  };
}

Take note that if you use the default path (/run/keys), the secret files are only stored in-memory and will not survive reboots. To upload your secrets without performing a full deployment, use colmena upload-keys.

Ad Hoc Evaluation

Sometimes you may want to extract values from your Hive configuration for consumption in another program (e.g., OctoDNS). To do that, create a .nix file with a lambda:

{ nodes, pkgs, lib, ... }:
# Feels like a NixOS module - But you can return any JSON-serializable value
lib.attrsets.mapAttrs (k: v: v.config.deployment.targetHost) nodes

Then you can obtain a JSON output with:

$ colmena eval target-hosts.nix
{"alpha":"fd12:3456::1","beta":"fd12:3456::2"}

You can also specify an expression directly on the command line:

$ colmena eval -E '{ nodes, pkgs, lib, ... }: ...'

Instantiation

You may directly instantiate an expression that evaluates to a derivation:

$ colmena eval --instantiate -E '{ nodes, ... }: nodes.alpha.config.boot.kernelPackages.kernel'
/nix/store/7ggmhnwvywrqcd1z2sdpan8afz55sw7z-linux-5.14.14.drv

Parallelism

Colmena is built from the ground up to support parallel deployments. Evaluation, build, and deployment of node configurations can happen at the same time. This parallelism can be controlled primarily through two flags:

--limit <number>

Number of hosts to deploy at once in the final step (pushing closures and activating new profiles). The default value is 10.

--eval-node-limit <number>

By default, Colmena will automatically determine the maximum number of nodes to evaluate at the same time according to available RAM. This flag allows you to set the limit to a predetermined value.

Examples

This section contains examples of setups people commonly use:

Multi-Architecture Deployments

You can deploy to hosts running different architectures with a single configuration. This requires you to either set up remote builders running the foreign architecture(s), or set up binfmt emulation on the host running Colmena.

binfmt Emulation

This following example sets up binfmt, allowing an X86-64 host (laptop) to build derivations for an AArch64 host (rpi) through QEMU:

{
  # The NixOS machine you are running Colmena on (x86_64-linux)
  laptop = { pkgs, ... }: {
    # Enable binfmt emulation for aarch64-linux
    boot.binfmt.emulatedSystems = [ "aarch64-linux" ];

    # ... Rest of configuration ...
  };

  # The remote machine running a foreign architecture (aarch64-linux)
  rpi = { pkgs, ... }: {
    # Override nixpkgs architecture
    nixpkgs.system = "aarch64-linux";

    # ... Rest of configuration ...
  };
}

(For Flake users, the above attribute set is the value of outputs.colmena)

First, deploy the local configuration with colmena apply-local --sudo. For more information on what is required on the local system, see Local Deployment.

After the new configuration is activated, binfmt emulation will be set up on the local machine. You can then deploy to the rpi node with colmena apply --on rpi.

Reference

This section contains detailed listings of options and parameters accepted by Colmena:

Deployment Options

Colmena adds a set of extra options that can be used in your NixOS configurations under the deployment prefix.

deployment.allowLocalDeployment

Allow the configuration to be applied locally on the host running Colmena.

For local deployment to work, all of the following must be true:

  • The node must be running NixOS.
  • The node must have deployment.allowLocalDeployment set to true.
  • The node's networking.hostName must match the hostname.

To apply the configurations locally, run colmena apply-local. You can also set deployment.targetHost to null if the nost is not accessible over SSH (only local deployment will be possible).

Type: boolean

Default

false

deployment.keys

A set of secrets to be deployed to the node.

Secrets are transferred to the node out-of-band and never ends up in the Nix store.

Type: attribute set of submodules

Default

{}

deployment.keys.<name>.destDir

Destination directory on the host.

Type: string

Default

"/run/keys"

deployment.keys.<name>.group

The group that will own the file.

Type: string

Default

"root"

deployment.keys.<name>.keyCommand

Command to run to generate the key. One of text, keyCommand and keyFile must be set.

Type: null or list of strings

Default

null

deployment.keys.<name>.keyFile

Path of the local file to read the key from. One of text, keyCommand and keyFile must be set.

Type: null or path

Default

null

deployment.keys.<name>.permissions

Permissions to set for the file.

Type: string

Default

"0600"

deployment.keys.<name>.text

Content of the key. One of text, keyCommand and keyFile must be set.

Type: null or string

Default

null

deployment.keys.<name>.uploadAt

When to upload the keys.

  • pre-activation (default): Upload the keys before activating the new system profile.
  • post-activation: Upload the keys after successfully activating the new system profile.

For colmena upload-keys, all keys are uploaded at the same time regardless of the configuration here.

Type: one of "pre-activation", "post-activation"

Default

"pre-activation"

deployment.keys.<name>.user

The group that will own the file.

Type: string

Default

"root"

deployment.privilegeEscalationCommand

Command to use to elevate privileges when activating the new profiles on SSH hosts.

This is used on SSH hosts when deployment.targetUser is not root. The user must be allowed to use the command non-interactively.

Type: list of strings

Default

["sudo","-H","--"]

deployment.replaceUnknownProfiles

Allow a configuration to be applied to a host running a profile we have no knowledge of. By setting this option to false, you reduce the likelyhood of rolling back changes made via another Colmena user.

Unknown profiles are usually the result of either:

  • The node had a profile applied, locally or by another Colmena.
  • The host running Colmena garbage-collecting the profile.

To force profile replacement on all targeted nodes during apply, use the flag --force-replace-unknown-profiles.

Type: boolean

Default

true

deployment.tags

A list of tags for the node.

Can be used to select a group of nodes for deployment.

Type: list of strings

Default

[]

deployment.targetHost

The target SSH node for deployment.

By default, the node's attribute name will be used. If set to null, only local deployment will be supported.

Type: null or string

Default

"nixos"

deployment.targetPort

The target SSH port for deployment.

By default, the port is the standard port (22) or taken from your ssh_config.

Type: null or unsigned integer, meaning >=0

Default

null

deployment.targetUser

The user to use to log into the remote node. If null, login as the current user.

Type: null or string

Default

"root"

Meta Options

The following is a list of options that can be added to the meta attribute set.

For compatibility with NixOps, you may name it network instead of meta. However, you cannot specify both at the same time.

description

A short description for the configuration.

Type: string

Default

"A Colmena Hive"

machinesFile

Use the machines listed in this file when building this hive configuration.

If your Colmena host has nix configured to allow for remote builds (for nix-daemon, your user being included in trusted-users) you can set a machines file that will be passed to the underlying nix-store command during derivation realization as a builders option. For example, if you support multiple orginizations each with their own build machine(s) you can ensure that builds only take place on your local machine and/or the machines specified in this file.

See https://nixos.org/manual/nix/stable/#chap-distributed-builds for the machine specification format.

Type: null or path

Default

null

name

Name of the configuration.

Type: string

Default

"hive"

nixpkgs

Pinned Nixpkgs. Accepts one of the following:

  • A path to a Nixpkgs checkout
  • The Nixpkgs lambda (e.g., import )
  • An initialized Nixpkgs attribute set

This option must be specified when using Flakes.

Type: unspecified

Default

null

nodeNixpkgs

Node-specific Nixpkgs overrides.

Type: attribute set of unspecifieds

Default

{}

specialArgs

A set of special arguments to be passed to NixOS modules.

This will be merged into the specialArgs used to evaluate the NixOS configurations.

Type: attribute set of unspecifieds

Default

{}

Command Line Arguments

The following are the help messages that will be printed when you invoke any sub-command with --help:

colmena

Colmena 0.2.2 Zhaofeng Li <hello@zhaofeng.li> NixOS deployment tool Colmena helps you deploy to multiple hosts running NixOS. For more details, read the manual at <https://zhaofengli.github.io/colmena/0.2>. USAGE: colmena [FLAGS] [OPTIONS] [SUBCOMMAND] FLAGS: -h, --help Prints help information --show-trace Passes --show-trace to Nix commands -V, --version Prints version information OPTIONS: -f, --config <CONFIG> If this argument is not specified, Colmena will search upwards from the current working directory for a file named "flake.nix" or "hive.nix". This behavior is disabled if --config/-f is given explicitly. For a sample configuration, check the manual at <https://zhaofengli.github.io/colmena/0.2>. [default: hive.nix] SUBCOMMANDS: apply Apply configurations on remote machines apply-local Apply configurations on the local machine build Build the configuration but not push to remote machines eval Evaluate expressions using the complete configuration exec Run a command on remote machines help Prints this message or the help of the given subcommand(s) nix-info Show information about the current Nix installation upload-keys Upload keys to remote hosts

colmena apply

colmena-apply Apply configurations on remote machines USAGE: colmena apply [FLAGS] [OPTIONS] [goal] FLAGS: --force-replace-unknown-profiles If `deployment.replaceUnknownProfiles` is set for a target, using this switch will treat deployment.replaceUnknownProfiles as though it was set true and perform unknown profile replacement. -h, --help Prints help information --keep-result Create GC roots for built profiles. The built system profiles will be added as GC roots so that they will not be removed by the garbage collector. The links will be created under .gcroots in the directory the Hive configuration is located. --no-gzip Disables the use of gzip when copying closures to the remote host. --no-keys Do not upload secret keys set in `deployment.keys`. By default, Colmena will upload keys set in `deployment.keys` before deploying the new profile on a node. To upload keys without building or deploying the rest of the configuration, use `colmena upload-keys`. --no-substitutes Disables the use of substituters when copying closures to the remote host. -V, --version Prints version information -v, --verbose Deactivates the progress spinner and prints every line of output. OPTIONS: --eval-node-limit <LIMIT> Limits the maximum number of hosts to be evaluated at once. The evaluation process is RAM-intensive. The default behavior is to limit the maximum number of host evaluated at the same time based on naive heuristics. Set to 0 to disable the limit. [default: auto] --on <NODES> Select a list of nodes to deploy to. The list is comma-separated and globs are supported. To match tags, prepend the filter by @. Valid examples: - host1,host2,host3 - edge-* - edge-*,core-* - @a-tag,@tags-can-have-* -p, --parallel <LIMIT> Limits the maximum number of hosts to be deployed in parallel. Set to 0 to disable parallemism limit. [default: 10] ARGS: <goal> Same as the targets for switch-to-configuration. "push" means only copying the closures to remote nodes. [default: switch] [possible values: build, push, switch, boot, test, dry-activate, keys]

colmena apply-local

colmena-apply-local Apply configurations on the local machine USAGE: colmena apply-local [FLAGS] [OPTIONS] [goal] FLAGS: -h, --help Prints help information --no-keys Do not deploy secret keys set in `deployment.keys`. By default, Colmena will deploy keys set in `deployment.keys` before activating the profile on this host. --sudo Attempt to escalate privileges if not run as root -V, --version Prints version information -v, --verbose Deactivates the progress spinner and prints every line of output. OPTIONS: --node <node> Override the node name to use --sudo-command <COMMAND> Command to use to escalate privileges [default: sudo] ARGS: <goal> Same as the targets for switch-to-configuration. "push" is noop in apply-local. [default: switch] [possible values: push, switch, boot, test, dry-activate]

colmena build

colmena-build Build the configuration but not push to remote machines This subcommand behaves as if you invoked `apply` with the `build` goal. USAGE: colmena build [FLAGS] [OPTIONS] FLAGS: --force-replace-unknown-profiles If `deployment.replaceUnknownProfiles` is set for a target, using this switch will treat deployment.replaceUnknownProfiles as though it was set true and perform unknown profile replacement. -h, --help Prints help information --keep-result Create GC roots for built profiles. The built system profiles will be added as GC roots so that they will not be removed by the garbage collector. The links will be created under .gcroots in the directory the Hive configuration is located. --no-gzip Disables the use of gzip when copying closures to the remote host. --no-keys Do not upload secret keys set in `deployment.keys`. By default, Colmena will upload keys set in `deployment.keys` before deploying the new profile on a node. To upload keys without building or deploying the rest of the configuration, use `colmena upload-keys`. --no-substitutes Disables the use of substituters when copying closures to the remote host. -V, --version Prints version information -v, --verbose Deactivates the progress spinner and prints every line of output. OPTIONS: --eval-node-limit <LIMIT> Limits the maximum number of hosts to be evaluated at once. The evaluation process is RAM-intensive. The default behavior is to limit the maximum number of host evaluated at the same time based on naive heuristics. Set to 0 to disable the limit. [default: auto] --on <NODES> Select a list of nodes to deploy to. The list is comma-separated and globs are supported. To match tags, prepend the filter by @. Valid examples: - host1,host2,host3 - edge-* - edge-*,core-* - @a-tag,@tags-can-have-* -p, --parallel <LIMIT> Limits the maximum number of hosts to be deployed in parallel. Set to 0 to disable parallemism limit. [default: 10]

colmena upload-keys

colmena-upload-keys Upload keys to remote hosts This subcommand behaves as if you invoked `apply` with the pseudo `keys` goal. USAGE: colmena upload-keys [FLAGS] [OPTIONS] FLAGS: --force-replace-unknown-profiles If `deployment.replaceUnknownProfiles` is set for a target, using this switch will treat deployment.replaceUnknownProfiles as though it was set true and perform unknown profile replacement. -h, --help Prints help information --keep-result Create GC roots for built profiles. The built system profiles will be added as GC roots so that they will not be removed by the garbage collector. The links will be created under .gcroots in the directory the Hive configuration is located. --no-gzip Disables the use of gzip when copying closures to the remote host. --no-keys Do not upload secret keys set in `deployment.keys`. By default, Colmena will upload keys set in `deployment.keys` before deploying the new profile on a node. To upload keys without building or deploying the rest of the configuration, use `colmena upload-keys`. --no-substitutes Disables the use of substituters when copying closures to the remote host. -V, --version Prints version information -v, --verbose Deactivates the progress spinner and prints every line of output. OPTIONS: --eval-node-limit <LIMIT> Limits the maximum number of hosts to be evaluated at once. The evaluation process is RAM-intensive. The default behavior is to limit the maximum number of host evaluated at the same time based on naive heuristics. Set to 0 to disable the limit. [default: auto] --on <NODES> Select a list of nodes to deploy to. The list is comma-separated and globs are supported. To match tags, prepend the filter by @. Valid examples: - host1,host2,host3 - edge-* - edge-*,core-* - @a-tag,@tags-can-have-* -p, --parallel <LIMIT> Limits the maximum number of hosts to be deployed in parallel. Set to 0 to disable parallemism limit. [default: 10]

colmena eval

colmena-eval Evaluate expressions using the complete configuration Your expression should take an attribute set with keys `pkgs`, `lib` and `nodes` (like a NixOS module) and return a JSON-serializable value. For example, to retrieve the configuration of one node, you may write something like: { nodes, ... }: nodes.node-a.config.networking.hostName USAGE: colmena eval [FLAGS] [OPTIONS] [FILE] FLAGS: -h, --help Prints help information --instantiate Actually instantiate the expression -V, --version Prints version information OPTIONS: -E <EXPRESSION> The Nix expression ARGS: <FILE> The .nix file containing the expression

colmena exec

colmena-exec Run a command on remote machines USAGE: colmena exec [FLAGS] [OPTIONS] [--] <COMMAND>... FLAGS: -h, --help Prints help information -V, --version Prints version information -v, --verbose Deactivates the progress spinner and prints every line of output. OPTIONS: --on <NODES> Select a list of nodes to deploy to. The list is comma-separated and globs are supported. To match tags, prepend the filter by @. Valid examples: - host1,host2,host3 - edge-* - edge-*,core-* - @a-tag,@tags-can-have-* -p, --parallel <LIMIT> Limits the maximum number of hosts to run the command in parallel. In `colmena exec`, the parallelism limit is disabled (0) by default. [default: 0] ARGS: <COMMAND>... Command to run It's recommended to use -- to separate Colmena options from the command to run. For example: colmena exec --on @routers -- tcpdump -vni any ip[9] == 89

colmena nix-info

colmena-nix-info Show information about the current Nix installation USAGE: colmena nix-info FLAGS: -h, --help Prints help information -V, --version Prints version information

Contributing

Contributions are welcome!

Code

You can checkout the source code and submit pull requests at the GitHub repo.

By contributing code to Colmena, you agree that your contributions will be available under the MIT License.

Issues & Feature Requests

Bumped into a problem? We would like to fix it! Please open a new issue at the GitHub repo.