-
-
Notifications
You must be signed in to change notification settings - Fork 20.1k
nixos/tests: implement X11 for nspawn; nixos/tests/firefox*: migrate to nspawn #543078
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
base: staging-nixos
Are you sure you want to change the base?
Changes from all commits
5cff3e9
24a3d82
9c3ae4b
ec40986
c8ca2f0
e07596c
16c90a1
55872d4
b13c508
b77f4ba
2c50570
246bfb4
1420582
2141140
a867d54
8de4347
74f2798
d335abc
474b148
e029cc2
64f11cc
2a94326
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| import datetime as dt | ||
| import json | ||
| from pathlib import Path | ||
| from typing import Literal | ||
|
|
||
| from pydantic import BaseModel, Field | ||
|
|
||
| DisplayBackend = Literal["x11"] | ||
| DisplayProtocol = Literal["vnc"] | ||
|
|
||
|
|
||
| class X11DisplayTargetConfiguration(BaseModel): | ||
| backend: DisplayBackend | ||
| display: str = ":0" | ||
| xauthority: Path = Path("/root/.Xauthority") | ||
|
|
||
|
|
||
| DisplayTargetConfiguration = X11DisplayTargetConfiguration | ||
|
|
||
|
|
||
| class VncDisplayViewerConfiguration(BaseModel): | ||
| kind: Literal["vnc"] | ||
| executable: Path | ||
|
|
||
|
|
||
| DisplayViewerConfiguration = VncDisplayViewerConfiguration | ||
|
|
||
|
|
||
| class NspawnX11VncExporterConfiguration(BaseModel): | ||
| kind: Literal["x11-vnc"] | ||
| server: Path | ||
| relay: Path | ||
|
Comment on lines
+31
to
+32
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure what
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I haven't made it far enough in this PR yet to read the code that actually sets/reads this Is it possible to avoid the tunneling and instead do something with a socket that we share through a bind mount with the container? |
||
|
|
||
|
|
||
| NspawnDisplayExporterConfiguration = NspawnX11VncExporterConfiguration | ||
|
|
||
|
|
||
| class MachineConfiguration(BaseModel): | ||
| name: str | ||
| start_script: Path | ||
|
|
||
|
|
||
| class QemuMachineConfiguration(MachineConfiguration): | ||
| pass | ||
|
|
||
|
|
||
| class NspawnMachineConfiguration(MachineConfiguration): | ||
| display_targets: list[DisplayTargetConfiguration] = Field(default_factory=list) | ||
| display_exporters: dict[DisplayBackend, NspawnDisplayExporterConfiguration] = Field( | ||
| default_factory=dict | ||
| ) | ||
|
|
||
|
|
||
| class DriverConfiguration(BaseModel): | ||
| vms: dict[str, QemuMachineConfiguration] | ||
| containers: dict[str, NspawnMachineConfiguration] | ||
| display_viewers: dict[DisplayProtocol, DisplayViewerConfiguration] = Field( | ||
| default_factory=dict | ||
| ) | ||
| vlans: list[int] | ||
| global_timeout: dt.timedelta | ||
| enable_ssh_backdoor: bool | ||
| test_script: Path | ||
|
|
||
|
|
||
| def load_driver_configuration(file_path: str) -> DriverConfiguration: | ||
| with open(file_path) as file: | ||
| data = json.load(file) | ||
| return DriverConfiguration.model_validate(data) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I'm not sure the default values here are a good idea. I checked, and the surrounding nix code that generates this config should always embed these values. Including defaults here just feels like a recipe for getting bit by a typo or something that causes the surround nix code to stop providing them. Perhaps comments with example value(s) would be better?