Use a different dataDir for Hydra?

The nspawn container runs as an independent container OS. On the host you define the nspawn settings, e.g.:

systemd.nspawn.myHydra = {
    enable = true;
    execConfig = {
      Boot = true;
      PrivateUsers = false;
    };
    networkConfig = { <bind some interfaces to the container> };
}

Then you can run nixos-install --root /var/lib/machines/myHydra to install NixOS into the container, where the minimal configuration.nix (in /var/lib/machines/myHydra/etc/nixos) for the container should contain:

  boot.isContainer = true;
  boot.loader.initScript.enable = true; # Create /sbin/init, needed for nspawn
1 Like