Stefan Kober · 4 min read

Simplifying OpenStack Deployment & Testing with NixOS: Introducing openstack-nix

Deploying and testing OpenStack can be complex, but what if you could do it reliably with just one command? Enter openstack-nix, a NixOS-based solution that brings reproducibility, modularity and hardware-independent testing to OpenStack deployments. In this post, we’ll explore how Nix packages and NixOS modules simplify OpenStack setup, customization and CI testing—making life easier for developers and operators alike. Whether you're looking to streamline development or contribute to open-source innovation, openstack-nix is here to help.

Simplifying OpenStack Deployment & Testing with NixOS: Introducing openstack-nix

At Cyberus we are very enthusiastic about Nix and NixOS because of its capabilities of reproducible builds and declarative configurations. In a recent project we faced the challenge of working with OpenStack, which required us to setup OpenStack in different configurations and make changes in its source code. OpenStack setup and configuration is a complex undertaking, there are many steps to take and many knobs and levers to pull. Even the Getting Started guide is quite a long read.

How do you reliably test changes in such a large software project, which consists of multiple large interdependent components? Especially, when you want to test that your changes behave correctly in a real-world scenario, where OpenStack runs and is used across multiple machines and all services have to correctly interact with each other?

Usually, the answer is to deploy it on physical hardware and run the tests there. However, doing so does not help to keep the test configuration consistent and does not help in keeping dependencies sorted. Additionally testing on physical hardware is typically cumbersome, as one now needs to manage the hardware in addition to the software pieces.

Nix offers a technology that has the possibility to make our life much easier by allowing to run complex tests inside of virtual machines on your developer hardware or your CI: NixOS tests.

Packaging OpenStack with Nix: The Birth of openstack-nix

The motivation of using NixOS and NixOS tests for developing, testing and deploying OpenStack changes led us to create openstack-nix.

openstack-nix is a set of Nix packages and Nix modules that allow using OpenStack on NixOS. The repository currently contains the following things:

  • Nix package descriptions for OpenStack python libraries
  • NixOS modules starting the basic OpenStack services (Keystone, Glance, Placement, Neutron, Nova and Horizon)
  • NixOS modules mimicking the configuration for a minimal OpenStack setup (e.g., create users and databases)
  • NixOS tests checking the OpenStack server creation and live migration

All of the items above are exported via Nix flakes and let users compose their own setup and tests of OpenStack.

Why Use Nix and NixOS for OpenStack Development?

Having OpenStack usable in NixOS enables a simple, yet customizable setup and comes with hardware independence out of the box.

Getting Started with OpenStack in a Single Command

openstack-nix makes the setup of OpenStack in a default configuration as simple as possible. We achieve this by setting up the default configuration, as described in OpenStack’s setup guide, automatically.

As a consequence, a single command line invocation is enough to spin up two virtual machines that contain a ready to use OpenStack installation to play around with.

Customizing OpenStack with NixOS Modules & Overrides

While a functional default configuration is provided, we have designed the NixOS modules in a way that lets the user specify a custom configuration for all relevant OpenStack services (e.g. a custom nova.conf).

Due to the Nix concept of overriding attributes, users are able to exchange OpenStack packages with their custom versions. This allows to customize the OpenStack cluster depending on your actual requirements.

Hardware-Independent OpenStack Testing with NixOS Integration Tests

openstack-nix enables to run a complete OpenStack setup in virtual machines and on top of that define test cases via the NixOS test framework. Therefore, development and testing becomes much easier.

Users are able to create and refine test cases on their local hardware. Once the test works as expected, it can easily become part of the CI pipeline and run in an automated fashion. No dedicated test hardware or shared development cluster is required.

OpenStack + NixOS: A Future of Reproducible, Modular Deployments

By bringing OpenStack support to NixOS we are able to benefit from NixOS properties like reproducibility and modularity while developing, testing and deploying OpenStack.

Interested? Head over to the GitHub project for technical documentation and try it out for yourself. We welcome contributions to the project to generalize it to support a wider range of use cases!

neonephos-foundation-image

This project was created in a joint effort with SAP and receives funding from the European Union.

Share: