diff options
author | Matthieu Coudron <mattator@gmail.com> | 2018-04-18 11:29:54 +0900 |
---|---|---|
committer | Matthieu Coudron <mattator@gmail.com> | 2018-04-27 18:32:15 +0900 |
commit | ca0604190e4428e1cdf9bb369fbbf73e1679e007 (patch) | |
tree | 839f536eedbbc644ef68897b41465c6bf8362bcc /nixos/modules/virtualisation/qemu-guest-agent.nix | |
parent | 903f694e34c5ab9169eff2be1fcd48d2c11d3bf6 (diff) | |
download | nixpkgs-ca0604190e4428e1cdf9bb369fbbf73e1679e007.tar nixpkgs-ca0604190e4428e1cdf9bb369fbbf73e1679e007.tar.gz nixpkgs-ca0604190e4428e1cdf9bb369fbbf73e1679e007.tar.bz2 nixpkgs-ca0604190e4428e1cdf9bb369fbbf73e1679e007.tar.lz nixpkgs-ca0604190e4428e1cdf9bb369fbbf73e1679e007.tar.xz nixpkgs-ca0604190e4428e1cdf9bb369fbbf73e1679e007.tar.zst nixpkgs-ca0604190e4428e1cdf9bb369fbbf73e1679e007.zip |
qemu-guest-agent: init module
Allow out of band communication between qemu VMs and the host. Useful to retrieve IPs of VMs from the host (for instance when libvirt can't analyze DHCP requests because VMs are configured with static addresses or when there is connectivity default).
Diffstat (limited to 'nixos/modules/virtualisation/qemu-guest-agent.nix')
-rw-r--r-- | nixos/modules/virtualisation/qemu-guest-agent.nix | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/nixos/modules/virtualisation/qemu-guest-agent.nix b/nixos/modules/virtualisation/qemu-guest-agent.nix new file mode 100644 index 00000000000..e0d2b3dc509 --- /dev/null +++ b/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.kvm.ga}/bin/qemu-ga"; + Restart = "always"; + RestartSec = 0; + }; + }; + } + ] + ); +} |