git.iko.soy/typeable/nixpkgs
on master help sign in
libvirt: 3.5.0 -> 3.6.0
commit84a6a3683b7e10122d7a2c00a150cc1b1c02c4bb authorVolth <volth@webmaster.ms> dateWed 2 Aug 2017, 01:18 (9 years ago) parentf0f55ac
3 files changed+28−27
nixos/modules/virtualisation/libvirtd.nix+14−22 pkgs/development/libraries/libvirt/default.nix+12−3 pkgs/top-level/python-packages.nix+2−2
nixos/modules/virtualisation/libvirtd.nix+14−22
@@ -15,7 +15,7 @@ let
1515 '';
1616 qemuConfigFile = pkgs.writeText "qemu.conf" ''
1717 ${optionalString cfg.qemuOvmf ''
18− nvram = ["${pkgs.OVMF.fd}/FV/OVMF_CODE.fd:${pkgs.OVMF.fd}/FV/OVMF_VARS.fd"]
18+ nvram = ["/run/libvirt/nix-ovmf/OVMF_CODE.fd:/run/libvirt/nix-ovmf/OVMF_VARS.fd"]
1919 ''}
2020 ${cfg.qemuVerbatimConfig}
2121 '';
@@ -102,9 +102,7 @@ in {
102102
103103 config = mkIf cfg.enable {
104104
105− environment.systemPackages = with pkgs;
106− [ libvirt netcat-openbsd ]
107− ++ optional cfg.enableKVM qemu_kvm;
105+ environment.systemPackages = with pkgs; [ libvirt netcat-openbsd ];
108106
109107 boot.kernelModules = [ "tun" ];
110108
@@ -129,7 +127,6 @@ in {
129127 dnsmasq
130128 ebtables
131129 ]
132− ++ optional cfg.enableKVM qemu_kvm
133130 ++ optional vswitch.enable vswitch.package;
134131
135132 preStart = ''
@@ -155,23 +152,18 @@ in {
155152 # Copy generated qemu config to libvirt directory
156153 cp -f ${qemuConfigFile} /var/lib/libvirt/qemu.conf
157154
158− # libvirtd puts the full path of the emulator binary in the machine
159− # config file. But this path can unfortunately be garbage collected
160− # while still being used by the virtual machine. So update the
161− # emulator path on each startup to something valid (re-scan $PATH).
162− for file in /var/lib/libvirt/qemu/*.xml /var/lib/libvirt/lxc/*.xml; do
163− test -f "$file" || continue
164− # get (old) emulator path from config file
165− emulator=$("${pkgs.xmlstarlet}/bin/xmlstarlet" select --template --value-of "/domain/devices/emulator" "$file")
166− # get a (definitely) working emulator path by re-scanning $PATH
167− new_emulator=$(PATH=${pkgs.libvirt}/libexec:$PATH command -v $(basename "$emulator"))
168− # write back
169− "${pkgs.xmlstarlet}/bin/xmlstarlet" edit --inplace --update "/domain/devices/emulator" -v "$new_emulator" "$file"
170−
171− # Also refresh the OVMF path. Files with no matches are ignored.
172− "${pkgs.xmlstarlet}/bin/xmlstarlet" edit --inplace --update "/domain/os/loader" -v "${pkgs.OVMF.fd}/FV/OVMF_CODE.fd" "$file"
173− done
174− ''; # */
155+ # stable (not GC'able as in /nix/store) paths for using in <emulator> section of xml configs
156+ mkdir -p /run/libvirt/nix-emulators
157+ ln -s --force ${pkgs.libvirt}/libexec/libvirt_lxc /run/libvirt/nix-emulators/
158+ ${optionalString pkgs.stdenv.isAarch64 "ln -s --force ${pkgs.qemu}/bin/qemu-system-aarch64 /run/libvirt/nix-emulators/"}
159+ ${optionalString cfg.enableKVM "ln -s --force ${pkgs.qemu_kvm}/bin/qemu-kvm /run/libvirt/nix-emulators/"}
160+
161+ ${optionalString cfg.qemuOvmf ''
162+ mkdir -p /run/libvirt/nix-ovmf
163+ ln -s --force ${pkgs.OVMF.fd}/FV/OVMF_CODE.fd /run/libvirt/nix-ovmf/
164+ ln -s --force ${pkgs.OVMF.fd}/FV/OVMF_VARS.fd /run/libvirt/nix-ovmf/
165+ ''}
166+ '';
175167
176168 serviceConfig = {
177169 Type = "notify";
pkgs/development/libraries/libvirt/default.nix+12−3
@@ -1,6 +1,6 @@
11{ stdenv, fetchurl, fetchpatch
22, pkgconfig, makeWrapper
3−, libxml2, gnutls, devicemapper, perl, python2, attr
3+, coreutils, libxml2, gnutls, devicemapper, perl, python2, attr
44, iproute, iptables, readline, lvm2, utillinux, systemd, libpciaccess, gettext
55, libtasn1, ebtables, libgcrypt, yajl, pmutils, libcap_ng, libapparmor
66, dnsmasq, libnl, libpcap, libxslt, xhtml1, numad, numactl, perlPackages
@@ -12,11 +12,11 @@ with stdenv.lib;
1212# if you update, also bump pythonPackages.libvirt or it will break
1313stdenv.mkDerivation rec {
1414 name = "libvirt-${version}";
15− version = "3.5.0";
15+ version = "3.6.0";
1616
1717 src = fetchurl {
1818 url = "http://libvirt.org/sources/${name}.tar.xz";
19− sha256 = "05mm4xdw6g960rwvc9189nhxpm1vrilnmpl4h4m1lha11pivlqr9";
19+ sha256 = "0gcyql5dp6j370kvik9hjhxirrg89m7l1q52yq0g75h7jpv9fb1s";
2020 };
2121
2222 patches = [ ./build-on-bsd.patch ];
@@ -36,6 +36,13 @@ stdenv.mkDerivation rec {
3636 PATH=${stdenv.lib.makeBinPath [ iproute iptables ebtables lvm2 systemd ]}:$PATH
3737 substituteInPlace configure \
3838 --replace 'as_dummy="/bin:/usr/bin:/usr/sbin"' 'as_dummy="${numad}/bin"'
39+
40+ # the path to qemu-kvm will be stored in VM's .xml and .save files
41+ # do not use "''${qemu_kvm}/bin/qemu-kvm" to avoid bound VMs to particular qemu derivations
42+ substituteInPlace src/qemu/qemu_capabilities.c \
43+ --replace '"/usr/libexec/qemu-kvm"' '"/run/libvirt/nix-emulators/${if stdenv.isAarch64 then "qemu-system-aarch64" else "qemu-kvm"}"'
44+ substituteInPlace src/lxc/lxc_conf.c \
45+ --replace 'lxc_path,' '"/run/libvirt/nix-emulators/libvirt_lxc",'
3946 '' + ''
4047 PATH=${dnsmasq}/bin:$PATH
4148 patchShebangs . # fixes /usr/bin/python references
@@ -77,6 +84,8 @@ stdenv.mkDerivation rec {
7784 --replace "lock/subsys" "lock"
7885 sed -e "/gettext\.sh/a \\\n# Added in nixpkgs:\ngettext() { \"${gettext}/bin/gettext\" \"\$@\"; }" \
7986 -i "$out/libexec/libvirt-guests.sh"
87+
88+ substituteInPlace $out/lib/systemd/system/libvirtd.service --replace /bin/kill ${coreutils}/bin/kill
8089 '' + optionalString stdenv.isLinux ''
8190 rm $out/lib/systemd/system/{virtlockd,virtlogd}.*
8291 wrapProgram $out/sbin/libvirtd \
pkgs/top-level/python-packages.nix+2−2
@@ -26512,13 +26512,13 @@ EOF
2651226512 };
2651326513
2651426514 libvirt = let
26515− version = "3.5.0";
26515+ version = "3.6.0";
2651626516 in assert version == pkgs.libvirt.version; pkgs.stdenv.mkDerivation rec {
2651726517 name = "libvirt-python-${version}";
2651826518
2651926519 src = pkgs.fetchurl {
2652026520 url = "http://libvirt.org/sources/python/${name}.tar.gz";
26521− sha256 = "06mc0cm4k90z8vxaslk3ifpajg8w8dvm0m2mxwcd6fdzps8fwpsw";
26521+ sha256 = "1l0s9cx38qb6x5xj32r531xap11m93c3gag30idj8fzkn74cpfgc";
2652226522 };
2652326523
2652426524 buildInputs = with self; [ python pkgs.pkgconfig pkgs.libvirt lxml ];