<commit_before># Xen hypervisor (Dom0) support.

{ config, lib, pkgs, ... }:

with lib;

let
  cfg = config.virtualisation.xen;
  xen = pkgs.xen;
in

{
  ###### interface

  options = {

    virtualisation.xen.enable =
      mkOption {
        default = false;
        description =
          ''
            Setting this option enables the Xen hypervisor, a
            virtualisation technology that allows multiple virtual
            machines, known as <emphasis>domains</emphasis>, to run
            concurrently on the physical machine.  NixOS runs as the
            privileged <emphasis>Domain 0</emphasis>.  This option
            requires a reboot to take effect.
          '';
      };

    virtualisation.xen.bootParams =
      mkOption {
        default = "";
        description =
          ''
            Parameters passed to the Xen hypervisor at boot time.
          '';
      };

    virtualisation.xen.domain0MemorySize =
      mkOption {
        default = 0;
        example = 512;
        description =
          ''
            Amount of memory (in MiB) allocated to Domain 0 on boot.
            If set to 0, all memory is assigned to Domain 0.
          '';
      };

    virtualisation.xen.bridge =
      mkOption {
        default = "xenbr0";
        description =
          ''
            Create a bridge for the Xen domUs to connect to.
          '';
      };

    virtualisation.xen.stored =
      mkOption {
        default = "${pkgs.xen}/bin/oxenstored";
        description =
          ''
            Xen Store daemon to use.
          '';
      };

    virtualisation.xen.trace =
      mkOption {
        default = false;
        description =
          ''
            Enable Xen tracing.
          '';
      };
  };


  ###### implementation

  config = mkIf cfg.enable {
    assertions = [ {<commit_msg>nixos/xen: do not use derivation in the default values<commit_after># Xen hypervisor (Dom0) support.

{ config, lib, pkgs, ... }:

with lib;

let
  cfg = config.virtualisation.xen;
  xen = pkgs.xen;
in

{
  ###### interface

  options = {

    virtualisation.xen.enable =
      mkOption {
        default = false;
        description =
          ''
            Setting this option enables the Xen hypervisor, a
            virtualisation technology that allows multiple virtual
            machines, known as <emphasis>domains</emphasis>, to run
            concurrently on the physical machine.  NixOS runs as the
            privileged <emphasis>Domain 0</emphasis>.  This option
            requires a reboot to take effect.
          '';
      };

    virtualisation.xen.bootParams =
      mkOption {
        default = "";
        description =
          ''
            Parameters passed to the Xen hypervisor at boot time.
          '';
      };

    virtualisation.xen.domain0MemorySize =
      mkOption {
        default = 0;
        example = 512;
        description =
          ''
            Amount of memory (in MiB) allocated to Domain 0 on boot.
            If set to 0, all memory is assigned to Domain 0.
          '';
      };

    virtualisation.xen.bridge =
      mkOption {
        default = "xenbr0";
        description =
          ''
            Create a bridge for the Xen domUs to connect to.
          '';
      };

    virtualisation.xen.stored =
      mkOption {
        default = null;
        description =
          ''
            Xen Store daemon to use. Defaults to oxenstored of the xen package.
          '';
        apply = x: if x == null then "${xen}/bin/oxenstored" else x;
      };

    virtualisation.xen.trace =
      mkOption {
        default = false;
        description =
          ''
            Enable Xen tracing.
          '';
      };
  };


  ###### implementation

  config = mkIf cfg.enable {
    assertions = [ {
{'fraction_non_alphanumeric': 0.0911957950065703, 'fraction_numerical': 0.005781865965834429, 'mean_word_length': 1.5305851063829787, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6528330', 'n_tokens_mistral': 1074, 'n_tokens_neox': 1016, 'n_words': 310}