at 18.09-beta 774 B view raw
1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let 6 cfg = config.services.qemuGuest; 7in { 8 9 options.services.qemuGuest = { 10 enable = mkOption { 11 type = types.bool; 12 default = false; 13 description = "Whether to enable the qemu guest agent."; 14 }; 15 }; 16 17 config = mkIf cfg.enable ( 18 mkMerge [ 19 { 20 21 services.udev.extraRules = '' 22 SUBSYSTEM=="virtio-ports", ATTR{name}=="org.qemu.guest_agent.0", TAG+="systemd" ENV{SYSTEMD_WANTS}="qemu-guest-agent.service" 23 ''; 24 25 systemd.services.qemu-guest-agent = { 26 description = "Run the QEMU Guest Agent"; 27 serviceConfig = { 28 ExecStart = "${pkgs.kvm.ga}/bin/qemu-ga"; 29 Restart = "always"; 30 RestartSec = 0; 31 }; 32 }; 33 } 34 ] 35 ); 36}