1 { config, lib, pkgs, ... }:
6 cfg = config.services.qemuGuest;
9 options.services.qemuGuest = {
13 description = "Whether to enable the qemu guest agent.";
15 package = mkPackageOption pkgs [ "qemu_kvm" "ga" ] { };
18 config = mkIf cfg.enable (
22 services.udev.extraRules = ''
23 SUBSYSTEM=="virtio-ports", ATTR{name}=="org.qemu.guest_agent.0", TAG+="systemd" ENV{SYSTEMD_WANTS}="qemu-guest-agent.service"
26 systemd.services.qemu-guest-agent = {
27 description = "Run the QEMU Guest Agent";
29 ExecStart = "${cfg.package}/bin/qemu-ga --statedir /run/qemu-ga";
32 # Runtime directory and mode
33 RuntimeDirectory = "qemu-ga";
34 RuntimeDirectoryMode = "0755";