From 6fd7f8e0e690e8c97ce419b522e38f900deea7e1 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 25 Feb 2011 15:07:52 +0000 Subject: [PATCH] * Add an Upstart job for libvirtd. svn path=/nixos/trunk/; revision=26114 --- modules/module-list.nix | 1 + modules/virtualisation/libvirtd.nix | 64 +++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 modules/virtualisation/libvirtd.nix diff --git a/modules/module-list.nix b/modules/module-list.nix index 6dee2a4aad3..5c1f3deab4c 100644 --- a/modules/module-list.nix +++ b/modules/module-list.nix @@ -167,5 +167,6 @@ ./tasks/network-interfaces.nix ./tasks/swraid.nix ./tasks/tty-backgrounds.nix + ./virtualisation/libvirtd.nix ./virtualisation/xen-dom0.nix ] diff --git a/modules/virtualisation/libvirtd.nix b/modules/virtualisation/libvirtd.nix new file mode 100644 index 00000000000..951139ee66a --- /dev/null +++ b/modules/virtualisation/libvirtd.nix @@ -0,0 +1,64 @@ +# Upstart jobs for libvirtd. + +{ config, pkgs, ... }: + +with pkgs.lib; + +let + + cfg = config.virtualisation.libvirtd; + +in + +{ + ###### interface + + options = { + + virtualisation.libvirtd.enable = + mkOption { + default = false; + description = + '' + This option enables libvirtd, a daemon that manages + virtual machines. You can interact with the daemon + (e.g. to start or stop VMs) using the + virsh command line tool, among others. + ''; + }; + + virtualisation.libvirtd.enableKVM = + mkOption { + default = true; + description = + '' + This option enables support for QEMU/KVM in libvirtd. + ''; + }; + + }; + + + ###### implementation + + config = mkIf cfg.enable { + + environment.systemPackages = [ pkgs.libvirt ]; + + jobs.libvirtd = + { description = "Libvirtd virtual machine management daemon"; + + startOn = "stopped udevtrigger"; + + path = + [ pkgs.bridge_utils pkgs.dmidecode + ] ++ optional cfg.enableKVM pkgs.qemu_kvm; + + exec = "${pkgs.libvirt}/sbin/libvirtd --daemon --verbose"; + + daemonType = "daemon"; + }; + + }; + +}