libvirt-guest: add user and group options

This commit is contained in:
Dmitriy Kholkin 2023-04-09 23:42:05 +03:00
parent 4d6e3477d6
commit b3ccadb732

View File

@ -34,6 +34,18 @@ let
}; };
guestsOptions = { name, ... }: { guestsOptions = { name, ... }: {
options = rec { options = rec {
connectUri = mkOption {
type = types.str;
default = "qemu:///system";
};
user = mkOption {
type = types.str;
default = "qemu-libvirtd";
};
group = mkOption {
type = types.str;
default = "qemu-libvirtd";
};
# TODO # TODO
autoStart = mkOption { autoStart = mkOption {
type = types.bool; type = types.bool;
@ -198,6 +210,11 @@ in {
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
RemainAfterExit = "yes"; RemainAfterExit = "yes";
User = guest.user;
Group = guest.group;
};
environment = {
LIBVIRT_DEFAULT_URI = guest.connectUri;
}; };
script = let script = let
xml = pkgs.writeText "libvirt-guest-${name}.xml" '' xml = pkgs.writeText "libvirt-guest-${name}.xml" ''