runNixOps :: AttrSet → Effect

Provision interrelated machine configurations and other cloud resources.

For a practical introduction, check out the guide Deploy a NixOps Network.



The NixOps deployment name.


NixOps network expressions and other files required for the deployment. Unlike some other deployment methods, NixOps needs access to the actual expression files.

Confidential information should not be committed and included here, but inserted via secrets.json and userSetupScript.


Default: ["network.nix"]

Files in src that are always used as network expressions.


Default: true

Whether to build the network during the Hercules CI build phase. This ensures that all packages are in the cache and avoids attempting a deployment when some packages can’t be built.


Default: []

Prebuild runs outside of NixOps, which means that some info may be missing. Specify extra network expressions here to fill in or override the missing definitions.


Default: []

Network files that are only used when deploying; not when prebuilding.


Default: "nixops-${name}.json"

Override the Hercules CI state file name, in case it’s necessary.

The state file only contains a single deployment.


Default: "nixops-${name}.known_hosts"

Some NixOps backends do not update the ~/.ssh/known_hosts file. runNixOps will persist this file as a state file with the name set here.


Default: "nixpkgs=${pkgs.path}", where pkgs is the Nixpkgs invocation that included the effects overlay.

Necessary for looking up <nixpkgs> or potentially other locations using angle bracket syntax.

…​ — remaining arguments

Other attributes are passed to mkEffect, which passes its remaining arguments to mkDerivation.

See also

  • runNixOS — a simpler solution for single pre-existing machines

  • runArion — deploy services to Docker using NixOS, Nix or Docker-based images