1 { config, lib, pkgs, ... }:
6 cfg = config.services.qemuGuest;
9 options.services.qemuGuest = {
13 description = lib.mdDoc "Whether to enable the qemu guest agent.";
17 default = pkgs.qemu_kvm.ga;
18 defaultText = literalExpression "pkgs.qemu_kvm.ga";
19 description = lib.mdDoc "The QEMU guest agent package.";
23 config = mkIf cfg.enable (
27 services.udev.extraRules = ''
28 SUBSYSTEM=="virtio-ports", ATTR{name}=="org.qemu.guest_agent.0", TAG+="systemd" ENV{SYSTEMD_WANTS}="qemu-guest-agent.service"
31 systemd.services.qemu-guest-agent = {
32 description = "Run the QEMU Guest Agent";
34 ExecStart = "${cfg.package}/bin/qemu-ga --statedir /run/qemu-ga";
37 # Runtime directory and mode
38 RuntimeDirectory = "qemu-ga";
39 RuntimeDirectoryMode = "0755";