Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/xen: declarative libxenlight, part I #363388

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion doc/manpage-urls.json
Original file line number Diff line number Diff line change
Expand Up @@ -322,5 +322,7 @@
"user@.service(5)": "https://www.freedesktop.org/software/systemd/man/user@.service.html",
"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"
}
35 changes: 35 additions & 0 deletions nixos/doc/manual/development/settings-options.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,41 @@ have a predefined type and string generator already declared under

: Creates PHP array that contains both indexed and associative values. For example, `lib.mkMixedArray [ "hello" "world" ] { "nix" = "is-great"; }` returns `['hello', 'world', 'nix' => 'is-great']`

`pkgs.formats.xenLight { type ? "cfg" }` []{#pkgs-formats-xenLight}

: A function taking an attribute set with values and returning a set with Xen Project Hypervisor-specific attributes `type` and `generate` as specified [below](#pkgs-formats-result).

: The `generate` function produces a minified, one-line configuration file.

: It is important to note that this function may not always produce parseable `libxenlight` configuration files. While it complies with the syntax requirements as defined in the {manpage}`xl.cfg(5)` documentation, Xen has some undocumented parsing quirks regarding the order of `SPECSTRING` key-value pairs. These quirks are most notable with `DISK_SPEC_STRING`, but a workaround for such ordering issues is to simply define values for keys that require a specific order as a preformatted string instead of an attribute set.

: For instance, the following disk configuration will produce `disk=["access=ro,vdev=hdc,devtype=cdrom,format=raw,target=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-image.iso"]`, which *should* be valid (as none of the parameters are [Positional Parameters](https://xenbits.xen.org/docs/unstable/man/xl-disk-configuration.5.html#Positional-Parameters)), but will fail, as `libxenlight` requires `format` to be the first attribute.
```nix
{
disk = [
{
format = "raw";
vdev = "hdc";
access = "ro";
devtype = "cdrom";
target = "${imageFile}";
}
];
}
```
This can be resolved by using a preformatted string instead of an attribute set:
```nix
{
disk = [
"format=raw,vdev=hdc,access=ro,devtype=cdrom,target=${imageFile}"
];
}
```

`type`

: A variable to determine if the function is parsing `xl.cfg` (The system-wide `xl` configuration) or `xl.conf` (Per-domain definitions). Setting this variable to anything other than `cfg` or `conf` is invalid.

[]{#pkgs-formats-result}
These functions all return an attribute set with these values:

Expand Down
3 changes: 3 additions & 0 deletions nixos/doc/manual/redirects.json
Original file line number Diff line number Diff line change
Expand Up @@ -1670,6 +1670,9 @@
"pkgs-formats-php": [
"index.html#pkgs-formats-php"
],
"pkgs-formats-xenLight": [
"index.html#pkgs-formats-xenLight"
],
"pkgs-formats-result": [
"index.html#pkgs-formats-result"
],
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1805,7 +1805,7 @@
./virtualisation/waagent.nix
./virtualisation/waydroid.nix
./virtualisation/xe-guest-utilities.nix
./virtualisation/xen-dom0.nix
./virtualisation/xen/dom0.nix
{
documentation.nixos.extraModules = [
./virtualisation/qemu-vm.nix
Expand Down
Loading
Loading