-
-
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
74bbd20
commit a901dca
Showing
2 changed files
with
59 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -321,5 +321,7 @@ | |
"[email protected](5)": "https://www.freedesktop.org/software/systemd/man/[email protected]", | ||
"userdbctl(1)": "https://www.freedesktop.org/software/systemd/man/userdbctl.html", | ||
"vconsole.conf(5)": "https://www.freedesktop.org/software/systemd/man/vconsole.conf.html", | ||
"veritytab(5)": "https://www.freedesktop.org/software/systemd/man/veritytab.html" | ||
"veritytab(5)": "https://www.freedesktop.org/software/systemd/man/veritytab.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" | ||
} |
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,56 @@ | ||
# Xen Project Hypervisor Domain 0 libxenlight configuration | ||
{ | ||
config, | ||
lib, | ||
pkgs, | ||
... | ||
}: | ||
|
||
let | ||
inherit (lib) mkIf mkOption attrByPath; | ||
|
||
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) -> ((attrByPath [ "autoballoon" ] "auto" cfg.settings) != "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; | ||
}; | ||
} |