Continuous deployment

You can have NixCI automatically deploy your code after a suite succeeds.

Step 1: Configuration

To activate the continuous deployment mechanism, add a deploy section to your NixCI configuration.

For example, this example deployment configures the packages.x86_64-linux.deploy-to-prod package to be run as a deployment:

{
  deploy = {
    example = {
      package = "packages.x86_64-linux.deploy-to-prod";
    };
  };
}

In particular, NixCI will nix run packages.x86_64-linux.deploy-to-prod , which will execute the package's meta.mainProgram .

Step 2: Secrets & Environment Variables

Deployments can access secrets and SSH keys as environment variables. See the Secrets & SSH Keys documentation for how to declare and use them.

NixCI also automatically provides git metadata as environment variables during deployments.

Reference schema

deploy: # optional
  # default: {}
  # Deploy Configurations
  <key>: 
    # DeployConfiguration
    enable: # optional
      # default: true
      # enable this deployment
      <boolean>
    package: # required
      # package of which the main program will be run
      <string>
    system: # optional
      # system on which the deployment will be run
      <string>
    branches: # optional
      # default: default
      # branches from which may be deployed
      # any of
      [ # Deploy from any branch
        any
      , # The same as "any"
        all
      , # Only deploy from the default branch
        default
      , # Deploy from any of this list of branches
        - <string>
      ]
    secrets: # optional
      # default: []
      # secrets provided to the deployment
      - <string>
    ssh-keys: # optional
      # default: []
      # ssh keys provided to the deployment
      - # SshKeyConfiguration
        secret: # required
          # name of the secret on NixCI to use as the private key
          <string>
        public-key: # required
          # public key of the ssh key
          <string>