Author: eelco
Date: Fri Feb 25 15:07:52 2011
New Revision: 26114
URL: https://svn.nixos.org/websvn/nix/?rev=26114&sc=1

Log:
* Add an Upstart job for libvirtd.

Added:
   nixos/trunk/modules/virtualisation/libvirtd.nix
Modified:
   nixos/trunk/modules/module-list.nix

Modified: nixos/trunk/modules/module-list.nix
==============================================================================
--- nixos/trunk/modules/module-list.nix Fri Feb 25 14:48:53 2011        (r26113)
+++ nixos/trunk/modules/module-list.nix Fri Feb 25 15:07:52 2011        (r26114)
@@ -167,5 +167,6 @@
   ./tasks/network-interfaces.nix
   ./tasks/swraid.nix
   ./tasks/tty-backgrounds.nix
+  ./virtualisation/libvirtd.nix
   ./virtualisation/xen-dom0.nix
 ]

Added: nixos/trunk/modules/virtualisation/libvirtd.nix
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ nixos/trunk/modules/virtualisation/libvirtd.nix     Fri Feb 25 15:07:52 
2011        (r26114)
@@ -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
+            <command>virsh</command> 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";
+      };
+
+  };
+
+}
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits

Reply via email to