"--set-credential=journal.forward_to_socket:/run/host/journal/socket",
]
+ for p in config.unit_properties:
+ cmdline += ["--property", p]
+
if args.verb == Verb.boot:
# Add nspawn options first since systemd-nspawn ignores all options after the first argument.
cmdline += args.cmdline
runtime_scratch: ConfigFeature
runtime_network: Network
runtime_build_sources: bool
+ unit_properties: list[str]
ssh_key: Optional[Path]
ssh_certificate: Optional[Path]
machine: Optional[str]
parse=config_parse_boolean,
help="Mount build sources and build directory in /work when booting the image",
),
+ ConfigSetting(
+ dest="unit_properties",
+ long="--unit-property",
+ metavar="PROPERTY",
+ section="Host",
+ parse=config_make_list_parser(delimiter=" ", unescape=True),
+ ),
ConfigSetting(
dest="ssh_key",
metavar="PATH",
Runtime Scratch: {config.runtime_scratch}
Runtime Network: {config.runtime_network}
Runtime Build Sources: {config.runtime_build_sources}
+ Unit Properties: {line_join_list(config.unit_properties)}
SSH Signing Key: {none_to_none(config.ssh_key)}
SSH Certificate: {none_to_none(config.ssh_certificate)}
Machine: {config.machine_or_name()}
description: str,
user: Optional[int] = None,
group: Optional[int] = None,
+ properties: Sequence[str] = (),
) -> list[str]:
return [
"systemd-run",
"--collect",
*(["--uid", str(user)] if user is not None else []),
*(["--gid", str(group)] if group is not None else []),
+ *([f"--property={p}" for p in properties]),
]
log=False,
foreground=True,
sandbox=config.sandbox(binary=None, network=True, devices=True, relaxed=True),
- scope=scope_cmd(name=name, description=f"mkosi Virtual Machine {name}"),
+ scope=scope_cmd(
+ name=name,
+ description=f"mkosi Virtual Machine {name}",
+ properties=config.unit_properties,
+ ),
) as (proc, innerpid):
# We have to close these before we wait for qemu otherwise we'll deadlock as qemu will never exit.
for fd in qemu_device_fds.values():
they were mounted to when running the build script when using `mkosi
boot` or `mkosi qemu`.
+`UnitProperties=`, `--unit-property=`
+
+: Configure systemd unit properties to add to the systemd scopes
+ allocated when using `mkosi boot` or `mkosi qemu`. These are passed
+ directly to the `--property` options of `systemd-nspawn` and
+ `systemd-run` respectively.
+
`SshKey=`, `--ssh-key=`
: Path to the X509 private key in PEM format to use to connect to a
"abc"
],
"UnifiedKernelImages": "auto",
+ "UnitProperties": [
+ "PROPERTY=VALUE"
+ ],
"UseSubvolumes": "auto",
"VerityCertificate": "/path/to/cert",
"VerityKey": null,
tools_tree_release=None,
tools_tree_repositories=["abc"],
unified_kernel_images=ConfigFeature.auto,
+ unit_properties=["PROPERTY=VALUE"],
use_subvolumes=ConfigFeature.auto,
verity_certificate=Path("/path/to/cert"),
verity_key=None,