Skip to content
/ nixops Public

NixOps is a tool for deploying to NixOS machines in a network or cloud.

License

Notifications You must be signed in to change notification settings

NixOS/nixops

NixOps

Warning

NixOps is in low-maintenance mode and probably not suited for new projects. Use at your own risks.

Note

An experimental rewrite of NixOps is happening underhttps://github.com/nixops4/nixops4

Test

NixOpsis a tool for deploying toNixOSmachines in a network or the cloud. Key features include:

  • Declarative:NixOps determines and carries out actions necessary to realise a deployment configuration.
  • Testable:Try your deployments onVirtualBoxorlibvirtd.
  • Multi Cloud Support:Currently supports deployments toAWS,Hetzner,andGCE
  • Separation of Concerns:Deployment descriptions are divided intologicalandphysicalaspects. This makes it easy to separate parts that saywhata machine should do fromwherethey should do it.
  • Extensible:NixOpsis extensible through a plugin infrastructure which can be used to provide additional backends.

For more information, please refer to theNixOps manual.

Running

NixOpsis included in nixpkgs and can be executed in a shell as follows:

$ nix-shell -p nixops

or for a bleeding edge version, including many fixes relative to the 1.7 series,

$ nix-shell -p nixopsUnstable

You may need access to a Nix remote builder if your system does not support the deployment'ssystembuilds directly. MacOS users may use a virtual machine with NixOS for this purpose.

It is also possible to use cross-compilation with NixOps, by settingnixpkgs.localSystemandnixpkgs.crossSystem.A mix of remote, emulated and cross builds is also possible; seethis writeup on eno.space.

Building And Developing

Building The Nix Package

You can build the Nix package by simply invokingnix-buildon the project root:

$ nix-build

Development Shell

shell.nixprovides an environment with all dependencies required for working onNixOps.You can usenix-shellto enter a shell suitable for working onNixOpswhich will contain all Python dependencies specified inpyproject.toml

$ nix-shell

Executing Tests

Inside the development shell the tests can be executed as follows:

$ pytest

Documentation

NixOps' documentation uses reStructuredText. When editing the docs, get a live-reloading, rendered version of the docs:

nixops$./live-docs.py
Serving on http://127.0.0.1:5500

and verify its lints before committing:

nixops$ lint-docs

Contributing

Contributions to the project are welcome in the form of GitHub PRs. Please consider the following guidelines before creating PRs:

  • Please make sure to format your code usingblack.
  • Please add type signatures usingmypy.
  • If you are planning to make any considerable changes, you should first present your plans in a GitHub issue so it can be discussed.
  • If you are adding features, please also add reasonable tests.

License

Licensed underLGPL-3.0.