From 1d64f5f41b79e7698dfe4bb866a290643b3b60ad Mon Sep 17 00:00:00 2001 From: Tristan Helmich Date: Tue, 21 Feb 2017 13:26:23 +0100 Subject: [PATCH] libvirt: expose libvirt qemu configuration file fixes #22823 --- nixos/modules/virtualisation/libvirtd.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/nixos/modules/virtualisation/libvirtd.nix b/nixos/modules/virtualisation/libvirtd.nix index 5f669dee754..101ea9a4f51 100644 --- a/nixos/modules/virtualisation/libvirtd.nix +++ b/nixos/modules/virtualisation/libvirtd.nix @@ -13,6 +13,9 @@ let auth_unix_rw = "none" ${cfg.extraConfig} ''; + qemuConfigFile = pkgs.writeText "qemu.conf" '' + ${cfg.qemuVerbatimConfig} + ''; in { @@ -48,6 +51,18 @@ in { ''; }; + virtualisation.libvirtd.qemuVerbatimConfig = mkOption { + type = types.lines; + default = '' + namespaces = [] + ''; + description = '' + Contents written to the qemu configuration file, qemu.conf. + Make sure to include a proper namespace configuration when + supplying custom configuration. + ''; + }; + virtualisation.libvirtd.extraOptions = mkOption { type = types.listOf types.str; default = [ ]; @@ -119,6 +134,9 @@ in { cp -npd ${pkgs.libvirt}/var/lib/$i /var/lib/$i done + # Copy generated qemu config to libvirt directory + cp -f ${qemuConfigFile} /var/lib/libvirt/qemu.conf + # libvirtd puts the full path of the emulator binary in the machine # config file. But this path can unfortunately be garbage collected # while still being used by the virtual machine. So update the