summary refs log tree commit diff
path: root/pkgs/applications/virtualization
diff options
context:
space:
mode:
authorThomas Strobel <ts468@cam.ac.uk>2015-01-29 09:58:28 +0100
committerThomas Strobel <ts468@cam.ac.uk>2015-02-25 23:30:44 +0100
commit3d4fbb874cbc3d5d179e9fab0f7099e95b34d960 (patch)
treee6c082d788372f2539176a52ba3c191f35cdc384 /pkgs/applications/virtualization
parent7cc7e9b64a3b4e23fd8d23e84d87cdb787155de7 (diff)
downloadnixlib-3d4fbb874cbc3d5d179e9fab0f7099e95b34d960.tar
nixlib-3d4fbb874cbc3d5d179e9fab0f7099e95b34d960.tar.gz
nixlib-3d4fbb874cbc3d5d179e9fab0f7099e95b34d960.tar.bz2
nixlib-3d4fbb874cbc3d5d179e9fab0f7099e95b34d960.tar.lz
nixlib-3d4fbb874cbc3d5d179e9fab0f7099e95b34d960.tar.xz
nixlib-3d4fbb874cbc3d5d179e9fab0f7099e95b34d960.tar.zst
nixlib-3d4fbb874cbc3d5d179e9fab0f7099e95b34d960.zip
Update: add new Xen versions + update NixOS Xen modules
Versions of XEN:
- Xen 4.5
- Xen 4.5 + XenServer patches
- Xen 4.4.1
Diffstat (limited to 'pkgs/applications/virtualization')
-rw-r--r--pkgs/applications/virtualization/xen/4.4.1.nix46
-rw-r--r--pkgs/applications/virtualization/xen/4.5.0.nix58
-rw-r--r--pkgs/applications/virtualization/xen/generic.nix (renamed from pkgs/applications/virtualization/xen/default.nix)87
3 files changed, 147 insertions, 44 deletions
diff --git a/pkgs/applications/virtualization/xen/4.4.1.nix b/pkgs/applications/virtualization/xen/4.4.1.nix
new file mode 100644
index 000000000000..a13a51a1d4ef
--- /dev/null
+++ b/pkgs/applications/virtualization/xen/4.4.1.nix
@@ -0,0 +1,46 @@
+{ callPackage, fetchurl, ... } @ args:
+
+let
+  # Xen 4.4.1
+  xenConfig = {
+    name = "xen-4.4.1";
+    version = "4.4.1";
+
+    src = fetchurl {
+      url = "http://bits.xensource.com/oss-xen/release/4.4.1/xen-4.4.1.tar.gz";
+      sha256 = "09gaqydqmy64s5pqnwgjyzhd3wc61xyghpqjfl97kmvm8ly9vd2m";
+    };
+
+    # Sources needed to build the xen tools and tools/firmware.
+    toolsGits =
+      [ # tag qemu-xen-4.4.1
+        { name = "qemu-xen";
+          url = git://xenbits.xen.org/qemu-upstream-4.4-testing.git;
+          rev = "65fc9b78ba3d868a26952db0d8e51cecf01d47b4";
+          sha256 = "e24fb58f773fd9134c5aae6d3ca7e9f754dc9822de92b1eb2cedc76faf911f18";
+        }
+        # tag xen-4.4.1
+        {  name = "qemu-xen-traditional";
+          url = git://xenbits.xen.org/qemu-xen-4.4-testing.git;
+          rev = "6ae4e588081620b141071eb010ec40aca7e12876";
+          sha256 = "b1ed1feb92fbe658273a8d6d38d6ea60b79c1658413dd93979d6d128d8554ded";
+        }
+      ];
+
+    firmwareGits =
+      [ # tag 1.7.3.1
+        { name = "seabios";
+          url = git://xenbits.xen.org/seabios.git;
+          rev = "7d9cbe613694924921ed1a6f8947d711c5832eee";
+          sha256 = "c071282bbcb1dd0d98536ef90cd1410f5d8da19648138e0e3863bc540d954a87";
+        }
+        { name = "ovmf";
+          url = git://xenbits.xen.org/ovmf.git;
+          rev = "447d264115c476142f884af0be287622cd244423";
+          sha256 = "7086f882495a8be1497d881074e8f1005dc283a5e1686aec06c1913c76a6319b";
+        }
+      ];
+
+  };
+
+in callPackage ./generic.nix (args // { xenConfig=xenConfig; })
diff --git a/pkgs/applications/virtualization/xen/4.5.0.nix b/pkgs/applications/virtualization/xen/4.5.0.nix
new file mode 100644
index 000000000000..176e15ea2c75
--- /dev/null
+++ b/pkgs/applications/virtualization/xen/4.5.0.nix
@@ -0,0 +1,58 @@
+{ callPackage, fetchurl, fetchgit, ... } @ args:
+
+let
+  # Xen 4.5.0
+  xenConfig = {
+    name = "xen-4.5.0";
+    version = "4.5.0";
+
+    src = fetchurl {
+      url = "http://bits.xensource.com/oss-xen/release/4.5.0/xen-4.5.0.tar.gz";
+      sha256 = "0fvg00d596gh6cfm51xr8kj2mghcyivrf6np3dafnbldnbi41nsv";
+    };
+
+    # Sources needed to build the xen tools and tools/firmware.
+    firmwareGits =
+      [ # tag 1.7.5
+        { name = "seabios";
+          url = git://xenbits.xen.org/seabios.git;
+          rev = "e51488c5f8800a52ac5c8da7a31b85cca5cc95d2";
+          sha256 = "b96a0b9f31cab0f3993d007dcbe5f1bd69ad02b0a23eb2dc8a3ed1aafe7985cb";
+        }
+        { name = "ovmf";
+          url = git://xenbits.xen.org/ovmf.git;
+          rev = "447d264115c476142f884af0be287622cd244423";
+          sha256 = "7086f882495a8be1497d881074e8f1005dc283a5e1686aec06c1913c76a6319b";
+        }
+      ];
+
+    toolsGits =
+      [ # tag qemu-xen-4.5.0
+        { name = "qemu-xen";
+          url = git://xenbits.xen.org/qemu-upstream-4.5-testing.git;
+          rev = "1ebb75b1fee779621b63e84fefa7b07354c43a99";
+          sha256 = "1j312q2mqvkvby9adkkxf7f1pn3nz85g5mr9nbg4qpf2y9cg122z";
+        }
+        # tag xen-4.5.0
+        { name = "qemu-xen-traditional";
+          url = git://xenbits.xen.org/qemu-xen-4.5-testing.git;
+          rev = "b0d42741f8e9a00854c3b3faca1da84bfc69bf22";
+          sha256 = "ce52b5108936c30ab85ec0c9554f88d5e7b34896f3acb666d56765b49c86f2af";
+        }
+      ];
+
+    xenserverPatches = let
+      patches = {
+        url = https://github.com/ts468/xen-4.5.pg.git;
+        rev = "3442b65b490f43c817cbc53369220d0b1ab9b785";
+        sha256 = "31436c15def0a300b3ea1a63b2208c4a3bcbb143db5c6488d4db370b3ceeb845";
+      };
+      in ''
+        cp -r ${fetchgit patches}/master patches
+        quilt push -a
+        substituteInPlace tools/xenguest/Makefile --replace "_BSD_SOURCE" "_DEFAULT_SOURCE"
+        '';
+  };
+
+in callPackage ./generic.nix (args // { xenConfig=xenConfig; })
+
diff --git a/pkgs/applications/virtualization/xen/default.nix b/pkgs/applications/virtualization/xen/generic.nix
index e6ad49f20351..da33af525f9d 100644
--- a/pkgs/applications/virtualization/xen/default.nix
+++ b/pkgs/applications/virtualization/xen/generic.nix
@@ -3,46 +3,20 @@
 , lvm2, utillinux, procps, texinfo, perl, pythonPackages
 , glib, bridge-utils, xlibs, pixman, iproute, udev, bison
 , flex, cmake, ocaml, ocamlPackages, figlet, libaio, yajl
-, checkpolicy, transfig, glusterfs, fetchgit, xz }:
+, checkpolicy, transfig, glusterfs, fetchgit, xz, spice
+, spice_protocol, usbredir, alsaLib, quilt
+, coreutils, gawk, gnused, gnugrep, diffutils, multipath_tools
+, inetutils, iptables, openvswitch, nbd, drbd, xenConfig
+, xenserverPatched ? false, ... }:
 
 with stdenv.lib;
 
 let
-  version = "4.4.1";
 
   libDir = if stdenv.is64bit then "lib64" else "lib";
 
-  # Sources needed to build the xen tools and tools/firmware.
-  toolsGits =
-    [ # tag qemu-xen-4.4.1
-      #{ name = "qemu-xen";
-      #  url = git://xenbits.xen.org/qemu-upstream-4.4-testing.git;
-      #  rev = "65fc9b78ba3d868a26952db0d8e51cecf01d47b4";
-      #  sha256 = "e7abaf0e927f7a2bba4c59b6dad6ae19e77c92689c94fa0384e2c41742f8cdb6";
-      #}
-      # tag xen-4.4.1
-      {  name = "qemu-xen-traditional";
-        url = git://xenbits.xen.org/qemu-xen-4.4-testing.git;
-        rev = "6ae4e588081620b141071eb010ec40aca7e12876";
-        sha256 = "b1ed1feb92fbe658273a8d6d38d6ea60b79c1658413dd93979d6d128d8554ded";
-      }
-    ];
-  firmwareGits =
-    [ # tag 1.7.3.1
-      { name = "seabios";
-        url = git://xenbits.xen.org/seabios.git;
-        rev = "7d9cbe613694924921ed1a6f8947d711c5832eee";
-        sha256 = "c071282bbcb1dd0d98536ef90cd1410f5d8da19648138e0e3863bc540d954a87";
-      }
-      { name = "ovmf";
-        url = git://xenbits.xen.org/ovmf.git;
-        rev = "447d264115c476142f884af0be287622cd244423";
-        sha256 = "7086f882495a8be1497d881074e8f1005dc283a5e1686aec06c1913c76a6319b";
-      }
-    ];
-
-
   # Sources needed to build the stubdoms and tools
+  # These sources are already rather old and probably do not change frequently
   xenExtfiles = [
       { url = http://xenbits.xensource.com/xen-extfiles/lwip-1.3.0.tar.gz;
         sha256 = "13wlr85s1hnvia6a698qpryyy12lvmqw0a05xmjnd0h71ralsbkp";
@@ -76,15 +50,15 @@ let
       }
     ];
 
+  scriptEnvPath = stdenv.lib.concatStrings (stdenv.lib.intersperse ":" (map (x: "${x}/bin")
+    [ coreutils gawk gnused gnugrep which perl diffutils utillinux multipath_tools
+      iproute inetutils iptables bridge_utils openvswitch nbd drbd ]));
 in
 
-stdenv.mkDerivation {
-  name = "xen-${version}";
 
-  src = fetchurl {
-    url = "http://bits.xensource.com/oss-xen/release/${version}/xen-${version}.tar.gz";
-    sha256 = "09gaqydqmy64s5pqnwgjyzhd3wc61xyghpqjfl97kmvm8ly9vd2m";
-  };
+
+stdenv.mkDerivation {
+  inherit (xenConfig) name version src;
 
   dontUseCmakeConfigure = true;
 
@@ -95,11 +69,15 @@ stdenv.mkDerivation {
       glib bridge-utils pixman iproute udev bison xlibs.libX11
       flex ocaml ocamlPackages.findlib figlet libaio
       checkpolicy pythonPackages.markdown transfig
-      glusterfs cmake
+      glusterfs cmake spice spice_protocol usbredir
+      alsaLib quilt
     ];
 
   pythonPath = [ pythonPackages.curses ];
 
+  patchPhase = if ((xenserverPatched == true) && (builtins.hasAttr "xenserverPatches" xenConfig))
+    then xenConfig.xenserverPatches
+    else "";
 
   preConfigure = ''
     # Fake wget: copy prefetched downloads instead
@@ -111,6 +89,13 @@ stdenv.mkDerivation {
     export PATH=$PATH:$PWD/wget
   '';
 
+  # TODO: If multiple arguments are given with with-extra-qemuu,
+  #       then the configuration aborts; the reason is unclear.
+  #       If you know how to fix it, please let me know! :)
+  #configureFlags = "--with-extra-qemuu-configure-args='--enable-spice --enable-usb-redir --enable-linux-aio'";
+
+  # TODO: Flask needs more testing before enabling it by default.
+  #makeFlags = "XSM_ENABLE=y FLASK_ENABLE=y PREFIX=$(out) CONFIG_DIR=/etc XEN_EXTFILES_URL=\\$(XEN_ROOT)/xen_ext_files ";
   makeFlags = "PREFIX=$(out) CONFIG_DIR=/etc XEN_EXTFILES_URL=\\$(XEN_ROOT)/xen_ext_files ";
 
   buildFlags = "xen tools stubdom";
@@ -136,6 +121,12 @@ stdenv.mkDerivation {
       substituteInPlace tools/ioemu-qemu-xen/xen-hooks.mak \
         --replace /usr/include/pci ${pciutils}/include/pci
 
+      substituteInPlace tools/hotplug/Linux/xen-backend.rules \
+        --replace /etc/xen/scripts $out/etc/xen/scripts
+
+      # blktap is not provided by xen, but by xapi
+      sed -i '/blktap/d' tools/hotplug/Linux/xen-backend.rules
+
       # Work around a bug in our GCC wrapper: `gcc -MF foo -v' doesn't
       # print the GCC version number properly.
       substituteInPlace xen/Makefile \
@@ -157,15 +148,17 @@ stdenv.mkDerivation {
       # overriden at runtime.
       substituteInPlace tools/hotplug/Linux/init.d/xendomains \
         --replace 'XENDOM_CONFIG=/etc/sysconfig/xendomains' "" \
+        --replace 'XENDOM_CONFIG=/etc/default/xendomains' "" \
+        --replace /etc/xen/scripts/hotplugpath.sh $out/etc/xen/scripts/hotplugpath.sh \
         --replace /bin/ls ls
 
       # Xen's tools and firmares need various git repositories that it
       # usually checks out at time using git.  We can't have that.
-      ${flip concatMapStrings toolsGits (x: let src = fetchgit x; in ''
+      ${flip concatMapStrings xenConfig.toolsGits (x: let src = fetchgit x; in ''
         cp -r ${src} tools/${src.name}-dir-remote
         chmod +w tools/${src.name}-dir-remote
       '')}
-      ${flip concatMapStrings firmwareGits (x: let src = fetchgit x; in ''
+      ${flip concatMapStrings xenConfig.firmwareGits (x: let src = fetchgit x; in ''
         cp -r ${src} tools/firmware/${src.name}-dir-remote
         chmod +w tools/firmware/${src.name}-dir-remote
       '')}
@@ -189,13 +182,19 @@ stdenv.mkDerivation {
 
   installPhase =
     ''
-      mkdir -p $out
+      mkdir -p $out $out/share
       cp -prvd dist/install/nix/store/*/* $out/
       cp -prvd dist/install/boot $out/boot
-      cp -prvd dist/install/etc $out/etc
+      cp -prvd dist/install/etc $out
       cp -dR docs/man1 docs/man5 $out/share/man/
       wrapPythonPrograms
-    ''; # */
+      substituteInPlace $out/etc/xen/scripts/hotplugpath.sh --replace SBINDIR=\"$out/sbin\" SBINDIR=\"$out/bin\"
+
+      shopt -s extglob
+      for i in $out/etc/xen/scripts/!(*.sh); do
+        sed -i '2s@^@export PATH=$out/bin:${scriptEnvPath}@' $i
+      done
+    '';
 
   meta = {
     homepage = http://www.xen.org/;