Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1682353805e3
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3d6f752c51ee
Choose a head ref
  • 2 commits
  • 3 files changed
  • 2 contributors

Commits on Apr 27, 2018

  1. 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).
    teto committed Apr 27, 2018
    Copy the full SHA
    ca06041 View commit details

Commits on May 9, 2018

  1. Merge pull request #39099 from teto/qemu_agent

    qemu-guest-agent: init module
    xeji authored May 9, 2018

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    3d6f752 View commit details
Showing with 48 additions and 0 deletions.
  1. +1 −0 nixos/modules/module-list.nix
  2. +36 −0 nixos/modules/virtualisation/qemu-guest-agent.nix
  3. +11 −0 nixos/modules/virtualisation/qemu-vm.nix
1 change: 1 addition & 0 deletions nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
@@ -780,6 +780,7 @@
./virtualisation/hyperv-guest.nix
./virtualisation/openvswitch.nix
./virtualisation/parallels-guest.nix
./virtualisation/qemu-guest-agent.nix
./virtualisation/rkt.nix
./virtualisation/virtualbox-guest.nix
./virtualisation/virtualbox-host.nix
36 changes: 36 additions & 0 deletions nixos/modules/virtualisation/qemu-guest-agent.nix
Original file line number Diff line number Diff line change
@@ -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;
};
};
}
]
);
}
11 changes: 11 additions & 0 deletions nixos/modules/virtualisation/qemu-vm.nix
Original file line number Diff line number Diff line change
@@ -360,6 +360,15 @@ in
type = types.enum [ "virtio" "scsi" "ide" ];
description = "The interface used for the virtual hard disks.";
};

guestAgent.enable =
mkOption {
default = true;
type = types.bool;
description = ''
Enable the Qemu guest agent.
'';
};
};

virtualisation.useBootLoader =
@@ -511,6 +520,8 @@ in
# Don't run ntpd in the guest. It should get the correct time from KVM.
services.timesyncd.enable = false;

services.qemuGuest.enable = cfg.qemu.guestAgent.enable;

system.build.vm = pkgs.runCommand "nixos-vm" { preferLocalBuild = true; }
''
mkdir -p $out/bin