nixos/libvirtd: support out-of-tree vhost-user drivers
Add an option allowing packages containing out-of-tree vhost-user drivers for QEMU to be specified. The relevant configurations are then linked at runtime where libvirt expects them. An example use case for this is virtiofs.
This commit is contained in:
parent
62c8b51c27
commit
77e5fa5ea6
1 changed files with 17 additions and 0 deletions
|
@ -116,6 +116,15 @@ let
|
|||
QEMU's swtpm options.
|
||||
'';
|
||||
};
|
||||
|
||||
vhostUserPackages = mkOption {
|
||||
type = types.listOf types.package;
|
||||
default = [ ];
|
||||
example = lib.literalExpression "[ pkgs.virtiofsd ]";
|
||||
description = lib.mdDoc ''
|
||||
Packages containing out-of-tree vhost-user drivers.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -502,6 +511,14 @@ in
|
|||
# https://libvirt.org/daemons.html#monolithic-systemd-integration
|
||||
systemd.sockets.libvirtd.wantedBy = [ "sockets.target" ];
|
||||
|
||||
systemd.tmpfiles.rules = let
|
||||
vhostUserCollection = pkgs.buildEnv {
|
||||
name = "vhost-user";
|
||||
paths = cfg.qemu.vhostUserPackages;
|
||||
pathsToLink = [ "/share/qemu/vhost-user" ];
|
||||
};
|
||||
in [ "L+ /var/lib/qemu/vhost-user - - - - ${vhostUserCollection}/share/qemu/vhost-user" ];
|
||||
|
||||
security.polkit = {
|
||||
enable = true;
|
||||
extraConfig = ''
|
||||
|
|
Loading…
Reference in a new issue