xe-guest-utilities: init at 6.2.0

use mkEnableOption

use sha256

add xe-guest-utilities to module-list.nix

Ben Booth 449d908b 63f1eb6b

+147
+1
lib/maintainers.nix
··· 51 51 bdimcheff = "Brandon Dimcheff <brandon@dimcheff.com>"; 52 52 benley = "Benjamin Staffin <benley@gmail.com>"; 53 53 bennofs = "Benno Fünfstück <benno.fuenfstueck@gmail.com>"; 54 + benwbooth = "Ben Booth <benwbooth@gmail.com>"; 54 55 berdario = "Dario Bertini <berdario@gmail.com>"; 55 56 bergey = "Daniel Bergey <bergey@teallabs.org>"; 56 57 bjg = "Brian Gough <bjg@gnu.org>";
+1
nixos/modules/module-list.nix
··· 542 542 ./virtualisation/virtualbox-host.nix 543 543 ./virtualisation/vmware-guest.nix 544 544 ./virtualisation/xen-dom0.nix 545 + ./virtualisation/xe-guest-utilities.nix 545 546 ]
+52
nixos/modules/virtualisation/xe-guest-utilities.nix
··· 1 + { config, lib, pkgs, ... }: 2 + with lib; 3 + let 4 + cfg = config.services.xe-guest-utilities; 5 + in { 6 + options = { 7 + services.xe-guest-utilities = { 8 + enable = mkEnableOption "Whether to enable the Xen guest utilities daemon."; 9 + }; 10 + }; 11 + config = mkIf cfg.enable { 12 + services.udev.packages = [ pkgs.xe-guest-utilities ]; 13 + systemd.tmpfiles.rules = [ "d /run/xenstored 0755 - - -" ]; 14 + 15 + systemd.services.xe-daemon = { 16 + description = "xen daemon file"; 17 + wantedBy = [ "multi-user.target" ]; 18 + after = [ "xe-linux-distribution.service" ]; 19 + requires = [ "proc-xen.mount" ]; 20 + path = [ pkgs.coreutils pkgs.iproute ]; 21 + serviceConfig = { 22 + PIDFile = "/run/xe-daemon.pid"; 23 + ExecStart = "${pkgs.xe-guest-utilities}/bin/xe-daemon -p /run/xe-daemon.pid"; 24 + ExecStop = "${pkgs.procps}/bin/pkill -TERM -F /run/xe-daemon.pid"; 25 + }; 26 + }; 27 + 28 + systemd.services.xe-linux-distribution = { 29 + description = "xen linux distribution service"; 30 + wantedBy = [ "multi-user.target" ]; 31 + before = [ "xend.service" ]; 32 + path = [ pkgs.xe-guest-utilities pkgs.coreutils pkgs.gawk pkgs.gnused ]; 33 + serviceConfig = { 34 + Type = "simple"; 35 + RemainAfterExit = "yes"; 36 + ExecStart = "${pkgs.xe-guest-utilities}/bin/xe-linux-distribution /var/cache/xe-linux-distribution"; 37 + }; 38 + }; 39 + 40 + systemd.mounts = [ 41 + { description = "Mount /proc/xen files"; 42 + what = "xenfs"; 43 + where = "/proc/xen"; 44 + type = "xenfs"; 45 + unitConfig = { 46 + ConditionPathExists = "/proc/xen"; 47 + RefuseManualStop = "true"; 48 + }; 49 + } 50 + ]; 51 + }; 52 + }
+75
pkgs/tools/virtualization/xe-guest-utilities/default.nix
··· 1 + { stdenv, fetchurl, bzip2, lzo, zlib, xz, bash, python, gnutar, gnused, gnugrep, which }: 2 + 3 + stdenv.mkDerivation (rec { 4 + name = "xe-guest-utilities"; 5 + version = "6.2.0"; 6 + meta = { 7 + description = "Citrix XenServer Tools"; 8 + homepage = http://citrix.com/English/ps2/products/product.asp?contentID=683148&ntref=hp_nav_US; 9 + maintainers = with stdenv.lib.maintainers; [ benwbooth ]; 10 + platforms = stdenv.lib.platforms.linux; 11 + license = [ stdenv.lib.licenses.gpl2 stdenv.lib.licenses.lgpl21 ]; 12 + }; 13 + src = fetchurl { 14 + url = "https://sources.archlinux.org/other/community/xe-guest-utilities/xe-guest-utilities_${version}-1120.tar.gz"; 15 + sha256 = "f9593cd9588188f80253e736f48d8dd94c5b517abb18316085f86acffab48794"; 16 + }; 17 + buildInputs = [ bzip2 gnutar gnused python lzo zlib xz stdenv gnugrep which ]; 18 + patches = [ ./ip-address.patch ]; 19 + postPatch = '' 20 + tar xf "$NIX_BUILD_TOP/$name-$version/xenstore-sources.tar.bz2" 21 + ''; 22 + 23 + buildPhase = '' 24 + export CC=gcc 25 + export CFLAGS='-Wall -Wstrict-prototypes -Wno-unused-local-typedefs -Wno-sizeof-pointer-memaccess' 26 + export PYTHON=python2 27 + cd "$NIX_BUILD_TOP/$name-$version/uclibc-sources" 28 + for file in Config.mk tools/libxc/Makefile tools/misc/Makefile tools/misc/lomount/Makefile tools/xenstore/Makefile; do 29 + substituteInPlace "$file" --replace -Werror "" 30 + done 31 + make -C tools/include 32 + make -C tools/libxc 33 + make -C tools/xenstore 34 + ''; 35 + 36 + installPhase = '' 37 + export CFLAGS+='-Wall -Wstrict-prototypes -Wno-unused-local-typedefs -Wno-sizeof-pointer-memaccess' 38 + if [[ $CARCH == x86_64 ]]; then 39 + export LIBLEAFDIR_x86_64=lib 40 + fi 41 + for f in include libxc xenstore; do 42 + [[ ! -d $NIX_BUILD_TOP/$name-$version/uclibc-sources/tools/$f ]] && continue 43 + make -C "$NIX_BUILD_TOP/$name-$version/uclibc-sources/tools/$f" DESTDIR="$out" BINDIR=/bin SBINDIR=/bin INCLUDEDIR=/include LIBDIR=/lib install 44 + done 45 + rm -r "$out"/var 46 + 47 + cd "$NIX_BUILD_TOP/$name-$version" 48 + install -Dm755 xe-update-guest-attrs "$out/bin/xe-update-guest-attrs" 49 + install -Dm755 xe-daemon "$out/bin/xe-daemon" 50 + install -Dm644 xen-vcpu-hotplug.rules "$out/lib/udev/rules.d/10-xen-vcpu-hotplug.rules" 51 + substituteInPlace "$out/bin/xe-daemon" --replace sbin bin 52 + substituteInPlace "$out/bin/xe-daemon" --replace /usr/ "$out/" 53 + substituteInPlace "$out/bin/xe-update-guest-attrs" --replace /usr/ "$out/" 54 + substituteInPlace "$out/bin/xe-update-guest-attrs" --replace 'export PATH=' 'export PATH=$PATH:' 55 + substituteInPlace "$out/lib/udev/rules.d/10-xen-vcpu-hotplug.rules" --replace /bin/sh '${bash}/bin/sh' 56 + 57 + cat <<'EOS' >"$out/bin/xe-linux-distribution" 58 + #!${bash}/bin/bash -eu 59 + . /etc/os-release 60 + if [[ $# -gt 0 ]]; then 61 + mkdir -p "$(dirname "$1")" 62 + exec 1>"$1" 63 + fi 64 + cat <<EOF 65 + os_distro="$ID" 66 + os_majorver="''${VERSION_ID%%.*}" 67 + os_minorver="''${VERSION_ID#*.}" 68 + os_uname="$(uname -r)" 69 + os_name="$PRETTY_NAME" 70 + EOF 71 + EOS 72 + chmod 0755 "$out/bin/xe-linux-distribution" 73 + ''; 74 + 75 + })
+16
pkgs/tools/virtualization/xe-guest-utilities/ip-address.patch
··· 1 + diff -uNr a/xe-update-guest-attrs b/xe-update-guest-attrs 2 + --- a/xe-update-guest-attrs 2012-09-25 12:45:14.000000000 +0200 3 + +++ b/xe-update-guest-attrs 2012-11-21 16:46:35.000000000 +0100 4 + @@ -177,9 +177,9 @@ 5 + # collisions:0 txqueuelen:0 6 + # RX bytes:3604609 (3.4 MiB) TX bytes:3604609 (3.4 MiB) 7 + 8 + -ifs=`/sbin/ifconfig | sed -n -e 's/^\([a-z0-9]\+\).*/name \1/p' \ 9 + - -e 's/.*inet addr:\('$IPADDR_RE'\) .*/ipv4 \1/p' \ 10 + - -e 's+.*inet6 addr: \('$IPADDR6_RE'\)/.*+ipv6 \1+p' | \ 11 + +ifs=`ip addr show | sed -n -e 's/^[[:digit:]]*: \([a-z0-9]*\): .*/name \1 /gp;' \ 12 + + -e 's/^[[:space:]]\{4\}inet \('${IPADDR_RE}'\)\/.*/ipv4 \1 /gp;' \ 13 + + -e 's/^[[:space:]]\{4\}inet6 \('${IPADDR6_RE}'\)\/.*/ipv6 \1 /gp;' | \ 14 + while read tag value; do 15 + case "${tag}" in 16 + name)
+2
pkgs/top-level/all-packages.nix
··· 3776 3776 3777 3777 xdummy = callPackage ../tools/misc/xdummy { }; 3778 3778 3779 + xe-guest-utilities = callPackage ../tools/virtualization/xe-guest-utilities { }; 3780 + 3779 3781 xflux = callPackage ../tools/misc/xflux { }; 3780 3782 3781 3783 xfsprogs = callPackage ../tools/filesystems/xfsprogs { };