XCP-ng
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    NiXOA: A declarative implementation of Xen Orchestra using flakes on NixOS

    Scheduled Pinned Locked Moved Infrastructure as Code
    nixos
    1 Posts 1 Posters 19 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • dalemD Offline
      dalem Pro Support Team
      last edited by dalem

      I have created two Nix flakes for running Xen Orchestra inside a NixOS virtual machine on XCP-ng. I am a strong supporter of Nix and NixOS, and I was interested in the idea of building Xen Orchestra from source in a fully declarative way.

      Requirements

      Before you begin, you need:
      • A virtual machine running NixOS
      • Flakes enabled (either in your system configuration or in your current shell)
      • The git package installed

      Overview of the Flakes

      There are two flakes:

      1. nixoa-vm

      This is the main flake of the project. It includes:
      • A Xen Orchestra package built from source
      • A libvhdi Nix module
      • Update and maintenance modules
      • System and user configuration modules
      • Xen guest tools (via xen-guest-agent)
      • Support for a separate user-config flake

      This flake is where the Xen Orchestra service and core functions are defined. It is not intended to be user editable when using it.

      1. user-config

      This flake contains your machine-specific settings.
      • configuration.nix
      Used for basic system settings such as:
      • Hostname
      • Username
      • Time zone
      • SSH keys
      • hardware-configuration.nix
      You must copy this file from /etc/nixos/hardware-configuration.nix into the root of the user-config directory.

      Making Customizations

      There are helper scripts to simplify setup. In the future, these may be replaced with a text-based user interface (TUI).

      In most cases, you will only need to edit:
      • configuration.nix – system-level settings
      • home.nix (optional) – if you want more control using Home Manager
      • config.nixoa.toml – only if you have custom Xen Orchestra server settings

      You usually do not need to edit config.nixoa.toml. If you do, avoid changing the Redis, sudo, or HTTPS mount settings unless you know exactly what you are doing, as this can break the system.

      Building the System

      After you finish editing your configuration:
      1. Go to the user-config directory
      2. Update inputs from nixoa-vm:

      nix flake update

      3.	Add all changed files (including hardware-configuration.nix):
      

      git add *

      4.	Commit your changes:
      

      git commit -m "Initial configuration"

      5.	Rebuild the system:
      

      sudo nixos-rebuild switch --flake .#nixoa

      (Replace nixoa if you changed the hostname.)

      Installer

      The documentation mentions an installer that automates most of these steps. It exists, but it still needs more testing and should be considered experimental.

      Optional Shell Enhancements

      If you change the shell for the xoa user from bash to zsh in configuration.nix, the system will automatically install several quality-of-life tools, including:
      • oh-my-posh
      • fzf
      • eza
      • bat
      • and other terminal enhancements

      This is a personal passion project that I built on my own. If you are interested, please take a look and share any feedback or suggestions:

      https://codeberg.org/NiXOA

      1 Reply Last reply Reply Quote 0
      • First post
        Last post