Successful NixOps Libvrtd Backend Deployment Examples

I’m been using NixOps with the Libvirtd backend but it’s been turtles all the way down with one problem overcome only to find another waiting.

If any one has any successful NixOps + Libvirtd backend deployment configurations they’d like to share, that’d be greatly appreciated.

The trivial example should work fine from the manual [1].

[1] NixOps User's Guide

Last week I tried using the libvirtd backend and had all sorts of issues as well. In the end I switched to VirtualBox and everything worked much better.

I would much prefer to use libvirtd but it looks like it’s under-maintained right now.

My base libvirt expression

{ lib, ... }:

  deployment = {
    targetEnv = "libvirtd";
    libvirtd = {
      vcpu = lib.mkDefault 1;
      memorySize = lib.mkDefault 1024;
      headless = lib.mkDefault true;
      baseImageSize = lib.mkDefault 10;

  # See
  system.activationScripts.nixops-vm-fix-931 = ''
    if ls -l /nix/store | grep sudo | grep -q nogroup; then
      mount -o remount,rw /nix/store
      chown -R root:nixbld /nix/store

While regarding architectures other than x86_64 it is more complicated.

1 Like