diff --git a/doc/manpage-urls.json b/doc/manpage-urls.json index e878caf042a45c..47909e69931267 100644 --- a/doc/manpage-urls.json +++ b/doc/manpage-urls.json @@ -172,6 +172,8 @@ "30-systemd-environment-d-generator(8)": "https://www.freedesktop.org/software/systemd/man/30-systemd-environment-d-generator.html", "halt(8)": "https://www.freedesktop.org/software/systemd/man/halt.html", "kernel-install(8)": "https://www.freedesktop.org/software/systemd/man/kernel-install.html", + "xl.cfg(5)": "https://xenbits.xen.org/docs/unstable/man/xl.cfg.5.html", + "xl.conf(5)": "https://xenbits.xen.org/docs/unstable/man/xl.conf.5.html", "libnss_myhostname.so.2(8)": "https://www.freedesktop.org/software/systemd/man/libnss_myhostname.so.2.html", "libnss_mymachines.so.2(8)": "https://www.freedesktop.org/software/systemd/man/libnss_mymachines.so.2.html", "libnss_resolve.so.2(8)": "https://www.freedesktop.org/software/systemd/man/libnss_resolve.so.2.html", diff --git a/nixos/modules/virtualisation/xen-boot-builder.sh b/nixos/modules/virtualisation/xen-boot-builder.sh deleted file mode 100644 index e69de29bb2d1d6..00000000000000 diff --git a/nixos/modules/virtualisation/xen-dom0.nix b/nixos/modules/virtualisation/xen-dom0.nix deleted file mode 100644 index e69de29bb2d1d6..00000000000000 diff --git a/nixos/modules/virtualisation/xen-domU.nix b/nixos/modules/virtualisation/xen-domU.nix deleted file mode 100644 index e69de29bb2d1d6..00000000000000 diff --git a/nixos/modules/virtualisation/xen/xl.nix b/nixos/modules/virtualisation/xen/xl.nix index e69de29bb2d1d6..972cd0c39fdf65 100644 --- a/nixos/modules/virtualisation/xen/xl.nix +++ b/nixos/modules/virtualisation/xen/xl.nix @@ -0,0 +1,55 @@ +# Xen Project Hypervisor Domain 0 libxenlight configuration +{ + config, + lib, + pkgs, + ... +}: + +let + inherit (lib) mkIf mkOption; + + cfg = config.virtualisation.xen; + + settingsFormat = pkgs.formats.xenLight { type = "conf"; }; +in +{ + ## Interface ## + + options.virtualisation.xen = { + settings = mkOption { + inherit (settingsFormat) type; + default = { }; + example = { + autoballoon = "off"; + bootloader_restrict = false; + lockfile = "/run/lock/xen/xl"; + max_grant_version = 256; + "vif.default.bridge" = "xenbr0"; + "vm.hvm.cpumask" = [ + "2" + "3-8,^5" + ]; + }; + description = '' + The contents of the `/etc/xen/xl.conf` file. + See {manpage}`xl.conf(5)` for available configuration options. + ''; + }; + }; + + ## Implementation ## + + config = mkIf cfg.enable { + assertions = [ + { + assertion = cfg.dom0Resources.memory != 0 -> !cfg.settings.autoballoon == "on"; + message = '' + Upstream Xen strongly recommends that autoballoon be set to "off" or "auto" if + virtualisation.xen.dom0Resources.memory is limiting the total Domain 0 memory. + ''; + } + ]; + environment.etc."xen/xl.conf".source = settingsFormat.generate "xl.conf" cfg.settings; + }; +}