aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/nixos/modules/virtualisation/qemu-guest-agent.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/nixos/modules/virtualisation/qemu-guest-agent.nix')
-rw-r--r--nixpkgs/nixos/modules/virtualisation/qemu-guest-agent.nix36
1 files changed, 36 insertions, 0 deletions
diff --git a/nixpkgs/nixos/modules/virtualisation/qemu-guest-agent.nix b/nixpkgs/nixos/modules/virtualisation/qemu-guest-agent.nix
new file mode 100644
index 00000000000..665224e35d8
--- /dev/null
+++ b/nixpkgs/nixos/modules/virtualisation/qemu-guest-agent.nix
@@ -0,0 +1,36 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.qemuGuest;
+in {
+
+ options.services.qemuGuest = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Whether to enable the qemu guest agent.";
+ };
+ };
+
+ config = mkIf cfg.enable (
+ mkMerge [
+ {
+
+ services.udev.extraRules = ''
+ SUBSYSTEM=="virtio-ports", ATTR{name}=="org.qemu.guest_agent.0", TAG+="systemd" ENV{SYSTEMD_WANTS}="qemu-guest-agent.service"
+ '';
+
+ systemd.services.qemu-guest-agent = {
+ description = "Run the QEMU Guest Agent";
+ serviceConfig = {
+ ExecStart = "${pkgs.qemu.ga}/bin/qemu-ga";
+ Restart = "always";
+ RestartSec = 0;
+ };
+ };
+ }
+ ]
+ );
+}