forked from mirrors/nixpkgs
Merge pull request #39099 from teto/qemu_agent
qemu-guest-agent: init module
This commit is contained in:
commit
3d6f752c51
|
@ -780,6 +780,7 @@
|
||||||
./virtualisation/hyperv-guest.nix
|
./virtualisation/hyperv-guest.nix
|
||||||
./virtualisation/openvswitch.nix
|
./virtualisation/openvswitch.nix
|
||||||
./virtualisation/parallels-guest.nix
|
./virtualisation/parallels-guest.nix
|
||||||
|
./virtualisation/qemu-guest-agent.nix
|
||||||
./virtualisation/rkt.nix
|
./virtualisation/rkt.nix
|
||||||
./virtualisation/virtualbox-guest.nix
|
./virtualisation/virtualbox-guest.nix
|
||||||
./virtualisation/virtualbox-host.nix
|
./virtualisation/virtualbox-host.nix
|
||||||
|
|
36
nixos/modules/virtualisation/qemu-guest-agent.nix
Normal file
36
nixos/modules/virtualisation/qemu-guest-agent.nix
Normal file
|
@ -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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
|
@ -360,6 +360,15 @@ in
|
||||||
type = types.enum [ "virtio" "scsi" "ide" ];
|
type = types.enum [ "virtio" "scsi" "ide" ];
|
||||||
description = "The interface used for the virtual hard disks.";
|
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 =
|
virtualisation.useBootLoader =
|
||||||
|
@ -511,6 +520,8 @@ in
|
||||||
# Don't run ntpd in the guest. It should get the correct time from KVM.
|
# Don't run ntpd in the guest. It should get the correct time from KVM.
|
||||||
services.timesyncd.enable = false;
|
services.timesyncd.enable = false;
|
||||||
|
|
||||||
|
services.qemuGuest.enable = cfg.qemu.guestAgent.enable;
|
||||||
|
|
||||||
system.build.vm = pkgs.runCommand "nixos-vm" { preferLocalBuild = true; }
|
system.build.vm = pkgs.runCommand "nixos-vm" { preferLocalBuild = true; }
|
||||||
''
|
''
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
|
|
Loading…
Reference in a new issue