runNixOps2
runNixOps2 :: AttrSet → Effect
Provision interrelated machine configurations and other cloud resources.
NixOps 2 is pre-release software, so this function is also subject to change. |
Parameters
flake
Optional flake (outputs) containing nixopsConfigurations.default
.
If you do not use a flake to specify the deployment, set src
instead.
If nix
is older than 2.4
, set nix
to a nix
package with flake support.
name
Optional NixOps deployment name.
If your NixOps state file contains a single deployment and you want to select
it automatically, you should leave this unset or null
.
src
Use when flake
is not set.
This should contain the NixOps network expressions and other files required for the deployment. Unlike some other deployment methods, NixOps needs access to the actual expression files, because it needs to evaluate with non-static arguments like secrets and IP adresses.
Confidential information should not be committed and included here, but inserted via
secrets.json
and userSetupScript
.
networkFiles
Use when flake
is not set.
A list of relative file path strings in src
that are used as network expressions.
Default: null
Example: ["nixops.nix"]
prebuild
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.
prebuildOnlyNetworkFiles
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.
prebuildNetworkArgs
Default: []
Prebuild runs outside of NixOps, which means that some info may be missing.
This lets you fill in arguments like those set witih nixops set-args
.
NIX_PATH
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.
action
Default: "switch"
; performing a full deployment, analogous to nixos-rebuild switch
but on all nodes and including resources.
Other valid values besides "switch"
are "dry-run"
, "plan"
, "build"
*, "create"
, "copy"
, "dry-activate"
, "test"
, "boot"
.
Note that your agent will not automatically push to the cache for build
. prebuild
(enabled by default) does take care of this. See also the NixOps deployment guide on prebuilding.
allowRecreate
Default: true
.
Whether to create cloud resources when they appear to have gone missing.
extraDeployArgs
Default: []
A list of strings that will be passed as extra arguments to nixops deploy
.
forgetState
Default: false
Whether it’s ok to delete the state. Only use this on stateless deployments; not on deployments that need the state file to remember IP addresses, cloud resource ids, etc.
This disables an assertion intended to prevent mistakes with cloud deployments.
…
— remaining arguments
Other attributes are passed to mkEffect, which passes its remaining arguments to mkDerivation
.
Return value
An effect that performs the specified action on the NixOps deployment.
The effect has the following attributes in addition to the attributes returned
by mkEffect
.
prebuilt
A derivation representing the built system configuration.
prebuilt.nodes
An attribute set containing the NixOS configurations of the prebuilt nodes
.
This is primarily useful for inspection with nix repl
.
prebuilt.machineInfo
An attribute set with various attributes, including resources
.
This is primarily useful for inspection with nix repl
.