Migrating to Nix in production

Hi @Elyhaka,

The first part of my question is: is our understanding of what could Nix/NixOS bring us in production correct?

Yes - seems quite spot on. You’ll need to still provide some way to do local development, if you’re used to docker-compose you can take a look at https://github.com/hercules-ci/arion

Let’s say we have switched our project to be built with Nix, and so we’re developping with it. What would be a sane practice for automated deployment?

That mostly depends on your workflow, but the first question is what CI you’ll use.

Either way, If you’re going to use nixops for deployments, it’s quite tricky to share the state of it between deployments.

From our understanding, if we have running nodes of NixOS instances we can use NixOps to manage those instances. Is it a good idea to execute NixOps from within a CI Task once the build is made to update all nodes automatically?

My recommendation would be to use terraform for provisioning, as it does that job very well.

We’re planning to add impure tasks to https://hercules-ci.com/, which will allow you to configure such automatic deployments.

If you’re looking to start with a very simple setup, I recommend taking a look at GitHub - cachix/cachix-action: Build software only once and put it in a global cache

6 Likes