-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nixos/xen: init Domain 0 xl configuration module
Signed-off-by: Fernando Rodrigues <[email protected]>
- Loading branch information
1 parent
0dfe7ef
commit fc8e8b2
Showing
5 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
}; | ||
} |