git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #23441 from oxij/pkg/pretty-xen

xen: modular expression

commit9e6ae2f60a109c6e5380c0fb3775e783a1fc8f00 authorGraham Christensen <graham@grahamc.com> dateTue 7 Mar 2017, 18:52 (10 years ago) parente206d5a442b8d4
8 files changed+583−315
nixos/modules/virtualisation/xen-dom0.nix+48−18 pkgs/applications/virtualization/qemu/default.nix+11−4 pkgs/applications/virtualization/xen/0000-fix-install-python.patch+16 pkgs/applications/virtualization/xen/0000-fix-ipxe-src.patch+27 pkgs/applications/virtualization/xen/4.5.nix+230−145 pkgs/applications/virtualization/xen/generic.nix+176−145 pkgs/applications/virtualization/xen/packages.nix+64 pkgs/top-level/all-packages.nix+11−3
nixos/modules/virtualisation/xen-dom0.nix+48−18
@@ -27,6 +27,36 @@ in
2727 '';
2828 };
2929
30+ virtualisation.xen.package = mkOption {
31+ type = types.package;
32+ default = pkgs.xen;
33+ defaultText = "pkgs.xen";
34+ example = literalExample "pkgs.xen-light";
35+ description = ''
36+ The package used for Xen binary.
37+ '';
38+ };
39+
40+ virtualisation.xen.qemu = mkOption {
41+ type = types.path;
42+ default = "${pkgs.xen}/lib/xen/bin/qemu-system-i386";
43+ defaultText = "''${pkgs.xen}/lib/xen/bin/qemu-system-i386";
44+ example = literalExample "''${pkgs.qemu_xen-light}/bin/qemu-system-i386";
45+ description = ''
46+ The qemu binary to use for Dom-0 backend.
47+ '';
48+ };
49+
50+ virtualisation.xen.qemu-package = mkOption {
51+ type = types.package;
52+ default = pkgs.xen;
53+ defaultText = "pkgs.xen";
54+ example = literalExample "pkgs.qemu_xen-light";
55+ description = ''
56+ The package with qemu binaries for xendomains.
57+ '';
58+ };
59+
3060 virtualisation.xen.bootParams =
3161 mkOption {
3262 default = "";
@@ -106,9 +136,9 @@ in
106136 message = "Xen currently does not support EFI boot";
107137 } ];
108138
109− virtualisation.xen.stored = mkDefault "${pkgs.xen}/bin/oxenstored";
139+ virtualisation.xen.stored = mkDefault "${cfg.package}/bin/oxenstored";
110140
111− environment.systemPackages = [ pkgs.xen ];
141+ environment.systemPackages = [ cfg.package ];
112142
113143 # Make sure Domain 0 gets the required configuration
114144 #boot.kernelPackages = pkgs.boot.kernelPackages.override { features={xen_dom0=true;}; };
@@ -144,7 +174,7 @@ in
144174
145175 system.extraSystemBuilderCmds =
146176 ''
147− ln -s ${pkgs.xen}/boot/xen.gz $out/xen.gz
177+ ln -s ${cfg.package}/boot/xen.gz $out/xen.gz
148178 echo "${toString cfg.bootParams}" > $out/xen-params
149179 '';
150180
@@ -180,19 +210,19 @@ in
180210
181211
182212 environment.etc =
183− [ { source = "${pkgs.xen}/etc/xen/xl.conf";
213+ [ { source = "${cfg.package}/etc/xen/xl.conf";
184214 target = "xen/xl.conf";
185215 }
186− { source = "${pkgs.xen}/etc/xen/scripts";
216+ { source = "${cfg.package}/etc/xen/scripts";
187217 target = "xen/scripts";
188218 }
189− { source = "${pkgs.xen}/etc/default/xendomains";
219+ { source = "${cfg.package}/etc/default/xendomains";
190220 target = "default/xendomains";
191221 }
192222 ];
193223
194224 # Xen provides udev rules.
195− services.udev.packages = [ pkgs.xen ];
225+ services.udev.packages = [ cfg.package ];
196226
197227 services.udev.path = [ pkgs.bridge-utils pkgs.iproute ];
198228
@@ -217,7 +247,7 @@ in
217247 time=0
218248 timeout=30
219249 # Wait for xenstored to actually come up, timing out after 30 seconds
220− while [ $time -lt $timeout ] && ! `${pkgs.xen}/bin/xenstore-read -s / >/dev/null 2>&1` ; do
250+ while [ $time -lt $timeout ] && ! `${cfg.package}/bin/xenstore-read -s / >/dev/null 2>&1` ; do
221251 time=$(($time+1))
222252 sleep 1
223253 done
@@ -228,8 +258,8 @@ in
228258 exit 1
229259 fi
230260
231− ${pkgs.xen}/bin/xenstore-write "/local/domain/0/name" "Domain-0"
232− ${pkgs.xen}/bin/xenstore-write "/local/domain/0/domid" 0
261+ ${cfg.package}/bin/xenstore-write "/local/domain/0/name" "Domain-0"
262+ ${cfg.package}/bin/xenstore-write "/local/domain/0/domid" 0
233263 '';
234264 };
235265
@@ -256,7 +286,7 @@ in
256286 '';
257287 serviceConfig = {
258288 ExecStart = ''
259− ${pkgs.xen}/bin/xenconsoled${optionalString cfg.trace " --log=all --log-dir=/var/log/xen"}
289+ ${cfg.package}/bin/xenconsoled${optionalString cfg.trace " --log=all --log-dir=/var/log/xen"}
260290 '';
261291 };
262292 };
@@ -267,8 +297,8 @@ in
267297 wantedBy = [ "multi-user.target" ];
268298 after = [ "xen-console.service" ];
269299 serviceConfig.ExecStart = ''
270− ${pkgs.xen}/lib/xen/bin/qemu-system-i386 -xen-domid 0 -xen-attach -name dom0 -nographic -M xenpv \
271− -monitor /dev/null -serial /dev/null -parallel /dev/null
300+ ${cfg.qemu} -xen-attach -xen-domid 0 -name dom0 -M xenpv \
301+ -nographic -monitor /dev/null -serial /dev/null -parallel /dev/null
272302 '';
273303 };
274304
@@ -277,7 +307,7 @@ in
277307 description = "Xen Watchdog Daemon";
278308 wantedBy = [ "multi-user.target" ];
279309 after = [ "xen-qemu.service" ];
280− serviceConfig.ExecStart = "${pkgs.xen}/bin/xenwatchdogd 30 15";
310+ serviceConfig.ExecStart = "${cfg.package}/bin/xenwatchdogd 30 15";
281311 serviceConfig.Type = "forking";
282312 serviceConfig.RestartSec = "1";
283313 serviceConfig.Restart = "on-failure";
@@ -366,11 +396,11 @@ in
366396 before = [ "dhcpd.service" ];
367397 restartIfChanged = false;
368398 serviceConfig.RemainAfterExit = "yes";
369− path = [ pkgs.xen ];
370− environment.XENDOM_CONFIG = "${pkgs.xen}/etc/sysconfig/xendomains";
399+ path = [ cfg.package cfg.qemu-package ];
400+ environment.XENDOM_CONFIG = "${cfg.package}/etc/sysconfig/xendomains";
371401 preStart = "mkdir -p /var/lock/subsys -m 755";
372− serviceConfig.ExecStart = "${pkgs.xen}/etc/init.d/xendomains start";
373− serviceConfig.ExecStop = "${pkgs.xen}/etc/init.d/xendomains stop";
402+ serviceConfig.ExecStart = "${cfg.package}/etc/init.d/xendomains start";
403+ serviceConfig.ExecStop = "${cfg.package}/etc/init.d/xendomains stop";
374404 };
375405
376406 };
pkgs/applications/virtualization/qemu/default.nix+11−4
@@ -9,7 +9,9 @@
99, pulseSupport ? !stdenv.isDarwin, libpulseaudio
1010, sdlSupport ? !stdenv.isDarwin, SDL
1111, vncSupport ? true, libjpeg, libpng
12−, spiceSupport ? !stdenv.isDarwin, spice, spice_protocol, usbredir
12+, spiceSupport ? !stdenv.isDarwin, spice, spice_protocol
13+, usbredirSupport ? spiceSupport, usbredir
14+, xenSupport ? false, xen
1315, x86Only ? false
1416, nixosTestRunner ? false
1517}:
@@ -24,6 +26,7 @@ in
2426
2527stdenv.mkDerivation rec {
2628 name = "qemu-"
29+ + stdenv.lib.optionalString xenSupport "xen-"
2730 + stdenv.lib.optionalString x86Only "x86-only-"
2831 + stdenv.lib.optionalString nixosTestRunner "for-vm-tests-"
2932 + version;
@@ -44,8 +47,10 @@ stdenv.mkDerivation rec {
4447 ++ optionals pulseSupport [ libpulseaudio ]
4548 ++ optionals sdlSupport [ SDL ]
4649 ++ optionals vncSupport [ libjpeg libpng ]
47− ++ optionals spiceSupport [ spice_protocol spice usbredir ]
48− ++ optionals stdenv.isLinux [ alsaLib libaio libcap_ng libcap attr ];
50+ ++ optionals spiceSupport [ spice_protocol spice ]
51+ ++ optionals usbredirSupport [ usbredir ]
52+ ++ optionals stdenv.isLinux [ alsaLib libaio libcap_ng libcap attr ]
53+ ++ optionals xenSupport [ xen ];
4954
5055 enableParallelBuilding = true;
5156
@@ -95,9 +100,11 @@ stdenv.mkDerivation rec {
95100 ++ optional numaSupport "--enable-numa"
96101 ++ optional seccompSupport "--enable-seccomp"
97102 ++ optional spiceSupport "--enable-spice"
103+ ++ optional usbredirSupport "--enable-usb-redir"
98104 ++ optional x86Only "--target-list=i386-softmmu,x86_64-softmmu"
99105 ++ optional stdenv.isDarwin "--enable-cocoa"
100− ++ optional stdenv.isLinux "--enable-linux-aio";
106+ ++ optional stdenv.isLinux "--enable-linux-aio"
107+ ++ optional xenSupport "--enable-xen";
101108
102109 postFixup =
103110 ''
pkgs/applications/virtualization/xen/0000-fix-install-python.patchnew file+16
@@ -0,0 +1,16 @@
1+tools/python/install-wrap script brakes shebangs patching, disable
2+
3+diff --git a/tools/Rules.mk b/tools/Rules.mk
4+index 87a56dc..a7da869 100644
5+--- a/tools/Rules.mk
6++++ b/tools/Rules.mk
7+@@ -90,8 +90,7 @@ CFLAGS += $(CFLAGS-y)
8+
9+ CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
10+
11+-INSTALL_PYTHON_PROG = \
12+- $(XEN_ROOT)/tools/python/install-wrap "$(PYTHON_PATH)" $(INSTALL_PROG)
13++INSTALL_PYTHON_PROG = $(INSTALL_PROG)
14+
15+ %.opic: %.c
16+ $(CC) $(CPPFLAGS) -DPIC $(CFLAGS) $(CFLAGS_$*.opic) -fPIC -c -o $@ $< $(APPEND_CFLAGS)
pkgs/applications/virtualization/xen/0000-fix-ipxe-src.patchnew file+27
@@ -0,0 +1,27 @@
1+hack to make etherboot use prefetched ipxe
2+
3+diff --git a/tools/firmware/etherboot/Makefile b/tools/firmware/etherboot/Makefile
4+index a0578d2..64428a0 100644
5+--- a/tools/firmware/etherboot/Makefile
6++++ b/tools/firmware/etherboot/Makefile
7+@@ -16,6 +16,7 @@ IPXE_TARBALL_URL ?= $(XEN_EXTFILES_URL)/ipxe-git-$(IPXE_GIT_TAG).tar.gz
8+
9+ D=ipxe
10+ T=ipxe.tar.gz
11++G=ipxe.git
12+
13+ ROMS = $(addprefix $D/src/bin/, $(addsuffix .rom, $(ETHERBOOT_NICS)))
14+
15+@@ -36,9 +37,9 @@ $T:
16+ fi
17+ mv _$T $T
18+
19+-$D/src/arch/i386/Makefile: $T Config
20+- rm -rf $D
21+- gzip -dc $T | tar xf -
22++$D/src/arch/i386/Makefile: $G Config
23++ mkdir $D
24++ cp -a $G/* $D
25+ for i in $$(cat patches/series) ; do \
26+ patch -d $D -p1 --quiet <patches/$$i || exit 1 ; \
27+ done
pkgs/applications/virtualization/xen/4.5.nix+230−145
@@ -1,152 +1,237 @@
1−{ callPackage, fetchurl, fetchpatch, fetchgit, ... } @ args:
1+{ stdenv, callPackage, fetchurl, fetchpatch, fetchgit
2+, withInternalQemu ? true
3+, withInternalTraditionalQemu ? true
4+, withInternalSeabios ? true
5+, withSeabios ? !withInternalSeabios, seabios ? null
6+, withInternalOVMF ? false # FIXME: tricky to build
7+, withOVMF ? false, OVMF
8+, withLibHVM ? true
9+
10+# qemu
11+, udev, pciutils, xorg, SDL, pixman, acl, glusterfs, spice_protocol, usbredir
12+, alsaLib
13+, ... } @ args:
14+
15+assert withInternalSeabios -> !withSeabios;
16+assert withInternalOVMF -> !withOVMF;
17+
18+with stdenv.lib;
19+
20+# Patching XEN? Check the XSAs at
21+# https://xenbits.xen.org/xsa/
22+# and try applying all the ones we don't have yet.
223
324let
4− # Xen 4.5.5
5− #
6− # Patching XEN? Check the XSAs and try applying all the ones we
7− # don't have yet.
8− #
9− # XSAs at: https://xenbits.xen.org/xsa/
10− xenConfig = rec {
11− version = "4.5.5";
12−
13− xsaPatch = { name , sha256 }: (fetchpatch {
14− url = "https://xenbits.xen.org/xsa/xsa${name}.patch";
15− inherit sha256;
16− });
17−
18− name = "xen-${version}";
19−
20− src = fetchurl {
21− url = "http://bits.xensource.com/oss-xen/release/${version}/${name}.tar.gz";
22− sha256 = "1y74ms4yc3znf8jc3fgyq94va2y0pf7jh8m9pfqnpgklywqnw8g2";
23− };
25+ xsaPatch = { name , sha256 }: (fetchpatch {
26+ url = "https://xenbits.xen.org/xsa/xsa${name}.patch";
27+ inherit sha256;
28+ });
2429
25− # Sources needed to build the xen tools and tools/firmware.
26− firmwareGits =
27− [
28− { git = { name = "seabios";
29− url = https://xenbits.xen.org/git-http/seabios.git;
30− rev = "rel-1.7.5";
31− sha256 = "0jk54ybhmw97pzyhpm6jr2x99f702kbn0ipxv5qxcbynflgdazyb";
32− };
33− patches = [ ./0000-qemu-seabios-enable-ATA_DMA.patch ];
34− }
35− ];
30+ qemuDeps = [
31+ udev pciutils xorg.libX11 SDL pixman acl glusterfs spice_protocol usbredir
32+ alsaLib
33+ ];
34+in
3635
37− toolsGits =
38− [
39− { git = { name = "qemu-xen";
40− url = https://xenbits.xen.org/git-http/qemu-xen.git;
41− rev = "refs/tags/qemu-xen-${version}";
42− sha256 = "014s755slmsc7xzy7qhk9i3kbjr2grxb5yznjp71dl6xxfvnday2";
43− };
44− patches = [
45− (xsaPatch {
46− name = "197-4.5-qemuu";
47− sha256 = "09gp980qdlfpfmxy0nk7ncyaa024jnrpzx9gpq2kah21xygy5myx";
48− })
49− (xsaPatch {
50− name = "208-qemuu-4.7";
51− sha256 = "0z9b1whr8rp2riwq7wndzcnd7vw1ckwx0vbk098k2pcflrzppgrb";
52− })
53− (xsaPatch {
54− name = "209-qemuu";
55− sha256 = "05df4165by6pzxrnizkw86n2f77k9i1g4fqqpws81ycb9ng4jzin";
56− })
57− ];
58− }
59− { git = { name = "qemu-xen-traditional";
60− url = https://xenbits.xen.org/git-http/qemu-xen-traditional.git;
61− # rev = "28c21388c2a32259cff37fc578684f994dca8c9f";
62− rev = "refs/tags/xen-${version}";
63− sha256 = "0n0ycxlf1wgdjkdl8l2w1i0zzssk55dfv67x8i6b2ima01r0k93r";
64− };
65− patches = [
66− (xsaPatch {
67− name = "197-4.5-qemut";
68− sha256 = "17l7npw00gyhqzzaqamwm9cawfvzm90zh6jjyy95dmqbh7smvy79";
69− })
70− (xsaPatch {
71− name = "199-trad";
72− sha256 = "0dfw6ciycw9a9s97sbnilnzhipnzmdm9f7xcfngdjfic8cqdcv42";
73− })
74− (xsaPatch {
75− name = "208-qemut";
76− sha256 = "0960vhchixp60j9h2lawgbgzf6mpcdk440kblk25a37bd6172l54";
77− })
78− (xsaPatch {
79− name = "209-qemut";
80− sha256 = "1hq8ghfzw6c47pb5vf9ngxwgs8slhbbw6cq7gk0nam44rwvz743r";
81− })
82− ];
83− }
84− { git = { name = "xen-libhvm";
85− url = https://github.com/ts468/xen-libhvm;
86− rev = "442dcc4f6f4e374a51e4613532468bd6b48bdf63";
87− sha256 = "9ba97c39a00a54c154785716aa06691d312c99be498ebbc00dc3769968178ba8";
88− };
89− description = ''
90− Helper library for reading ACPI and SMBIOS firmware values
91− from the host system for use with the HVM guest firmware
92− pass-through feature in Xen.
93− '';
94− #license = licenses.bsd2;
95− }
96− ];
36+callPackage (import ./generic.nix (rec {
37+ version = "4.5.5";
9738
98− xenPatches = [ ./0001-libxl-Spice-image-compression-setting-support-for-up.patch
99− ./0002-libxl-Spice-streaming-video-setting-support-for-upst.patch
100− ./0003-Add-qxl-vga-interface-support-for-upstream-qem.patch
101− (xsaPatch {
102− name = "190-4.5";
103− sha256 = "0f8pw38kkxky89ny3ic5h26v9zsjj9id89lygx896zc3w1klafqm";
104− })
105− (xsaPatch {
106− name = "191-4.6";
107− sha256 = "1wl1ndli8rflmc44pkp8cw4642gi8z7j7gipac8mmlavmn3wdqhg";
108− })
109− (xsaPatch {
110− name = "192-4.5";
111− sha256 = "0m8cv0xqvx5pdk7fcmaw2vv43xhl62plyx33xqj48y66x5z9lxpm";
112− })
113− (xsaPatch {
114− name = "193-4.5";
115− sha256 = "0k9mykhrpm4rbjkhv067f6s05lqmgnldcyb3vi8cl0ndlyh66lvr";
116− })
117− (xsaPatch {
118− name = "195";
119− sha256 = "0m0g953qnjy2knd9qnkdagpvkkgjbk3ydgajia6kzs499dyqpdl7";
120− })
121− (xsaPatch {
122− name = "196-0001-x86-emul-Correct-the-IDT-entry-calculation-in-inject";
123− sha256 = "0z53nzrjvc745y26z1qc8jlg3blxp7brawvji1hx3s74n346ssl6";
124− })
125− (xsaPatch {
126− name = "196-0002-x86-svm-Fix-injection-of-software-interrupts";
127− sha256 = "11cqvr5jn2s92wsshpilx9qnfczrd9hnyb5aim6qwmz3fq3hrrkz";
128− })
129− (xsaPatch {
130− name = "198";
131− sha256 = "0d1nndn4p520c9xa87ixnyks3mrvzcri7c702d6mm22m8ansx6d9";
132− })
133− (xsaPatch {
134− name = "200-4.6";
135− sha256 = "0k918ja83470iz5k4vqi15293zjvz2dipdhgc9sy9rrhg4mqncl7";
136− })
137− (xsaPatch {
138− name = "202-4.6";
139− sha256 = "0nnznkrvfbbc8z64dr9wvbdijd4qbpc0wz2j5vpmx6b32sm7932f";
140− })
141− (xsaPatch {
142− name = "204-4.5";
143− sha256 = "083z9pbdz3f532fnzg7n2d5wzv6rmqc0f4mvc3mnmkd0rzqw8vcp";
144− })
145− (xsaPatch {
146− name = "207";
147− sha256 = "0wdlhijmw9mdj6a82pyw1rwwiz605dwzjc392zr3fpb2jklrvibc";
148− })
149− ];
39+ src = fetchurl {
40+ url = "http://bits.xensource.com/oss-xen/release/${version}/xen-${version}.tar.gz";
41+ sha256 = "1y74ms4yc3znf8jc3fgyq94va2y0pf7jh8m9pfqnpgklywqnw8g2";
15042 };
15143
152−in callPackage ./generic.nix (args // { xenConfig=xenConfig; })
44+ # Sources needed to build tools and firmwares.
45+ xenfiles = optionalAttrs withInternalQemu {
46+ "qemu-xen" = {
47+ src = fetchgit {
48+ url = https://xenbits.xen.org/git-http/qemu-xen.git;
49+ rev = "refs/tags/qemu-xen-${version}";
50+ sha256 = "014s755slmsc7xzy7qhk9i3kbjr2grxb5yznjp71dl6xxfvnday2";
51+ };
52+ buildInputs = qemuDeps;
53+ patches = [
54+ (xsaPatch {
55+ name = "197-4.5-qemuu";
56+ sha256 = "09gp980qdlfpfmxy0nk7ncyaa024jnrpzx9gpq2kah21xygy5myx";
57+ })
58+ (xsaPatch {
59+ name = "208-qemuu-4.7";
60+ sha256 = "0z9b1whr8rp2riwq7wndzcnd7vw1ckwx0vbk098k2pcflrzppgrb";
61+ })
62+ (xsaPatch {
63+ name = "209-qemuu/0001-display-cirrus-ignore-source-pitch-value-as-needed-i";
64+ sha256 = "1xvxzsrsq05fj6szjlpbgg4ia3cw54dn5g7xzq1n1dymbhv606m0";
65+ })
66+ (xsaPatch {
67+ name = "209-qemuu/0002-cirrus-add-blit_is_unsafe-call-to-cirrus_bitblt_cput";
68+ sha256 = "0avxqs9922qjfsxxlk7bh10432a526j2yyykhags8dk1bzxkpxwv";
69+ })
70+ ];
71+ meta.description = "Xen's fork of upstream Qemu";
72+ };
73+ } // optionalAttrs withInternalTraditionalQemu {
74+ "qemu-xen-traditional" = {
75+ src = fetchgit {
76+ url = https://xenbits.xen.org/git-http/qemu-xen-traditional.git;
77+ rev = "refs/tags/xen-${version}";
78+ sha256 = "0n0ycxlf1wgdjkdl8l2w1i0zzssk55dfv67x8i6b2ima01r0k93r";
79+ };
80+ buildInputs = qemuDeps;
81+ patches = [
82+ (xsaPatch {
83+ name = "197-4.5-qemut";
84+ sha256 = "17l7npw00gyhqzzaqamwm9cawfvzm90zh6jjyy95dmqbh7smvy79";
85+ })
86+ (xsaPatch {
87+ name = "199-trad";
88+ sha256 = "0dfw6ciycw9a9s97sbnilnzhipnzmdm9f7xcfngdjfic8cqdcv42";
89+ })
90+ (xsaPatch {
91+ name = "208-qemut";
92+ sha256 = "0960vhchixp60j9h2lawgbgzf6mpcdk440kblk25a37bd6172l54";
93+ })
94+ (xsaPatch {
95+ name = "209-qemut";
96+ sha256 = "1hq8ghfzw6c47pb5vf9ngxwgs8slhbbw6cq7gk0nam44rwvz743r";
97+ })
98+ ];
99+ postPatch = ''
100+ substituteInPlace xen-hooks.mak \
101+ --replace /usr/include/pci ${pciutils}/include/pci
102+ '';
103+ meta.description = "Xen's fork of upstream Qemu that uses old device model";
104+ };
105+ } // optionalAttrs withInternalSeabios {
106+ "firmware/seabios-dir-remote" = {
107+ src = fetchgit {
108+ url = https://xenbits.xen.org/git-http/seabios.git;
109+ rev = "e51488c5f8800a52ac5c8da7a31b85cca5cc95d2";
110+ #rev = "rel-1.7.5";
111+ sha256 = "0jk54ybhmw97pzyhpm6jr2x99f702kbn0ipxv5qxcbynflgdazyb";
112+ };
113+ patches = [ ./0000-qemu-seabios-enable-ATA_DMA.patch ];
114+ meta.description = "Xen's fork of Seabios";
115+ };
116+ } // optionalAttrs withInternalOVMF {
117+ "firmware/ovmf-dir-remote" = {
118+ src = fetchgit {
119+ url = https://xenbits.xen.org/git-http/ovmf.git;
120+ rev = "cb9a7ebabcd6b8a49dc0854b2f9592d732b5afbd";
121+ sha256 = "07zmdj90zjrzip74fvd4ss8n8njk6cim85s58mc6snxmqqv7gmcq";
122+ };
123+ meta.description = "Xen's fork of OVMF";
124+ };
125+ } // {
126+ # TODO: patch Xen to make this optional?
127+ "firmware/etherboot/ipxe.git" = {
128+ src = fetchgit {
129+ url = https://git.ipxe.org/ipxe.git;
130+ rev = "9a93db3f0947484e30e753bbd61a10b17336e20e";
131+ sha256 = "1ga3h1b34q0cl9azj7j9nswn7mfcs3cgfjdihrm5zkp2xw2hpvr6";
132+ };
133+ meta.description = "Xen's fork of iPXE";
134+ };
135+ } // optionalAttrs withLibHVM {
136+ "xen-libhvm-dir-remote" = {
137+ src = fetchgit {
138+ name = "xen-libhvm";
139+ url = https://github.com/ts468/xen-libhvm;
140+ rev = "442dcc4f6f4e374a51e4613532468bd6b48bdf63";
141+ sha256 = "9ba97c39a00a54c154785716aa06691d312c99be498ebbc00dc3769968178ba8";
142+ };
143+ buildPhase = ''
144+ make
145+ cd biospt
146+ cc -Wall -g -D_LINUX -Wstrict-prototypes biospt.c -o biospt -I../libhvm -L../libhvm -lxenhvm
147+ '';
148+ installPhase = ''
149+ make install
150+ cp biospt/biospt $out/bin/
151+ '';
152+ meta = {
153+ description = ''
154+ Helper library for reading ACPI and SMBIOS firmware values
155+ from the host system for use with the HVM guest firmware
156+ pass-through feature in Xen'';
157+ license = licenses.bsd2;
158+ };
159+ };
160+ };
161+
162+ configureFlags = []
163+ ++ optional (!withInternalQemu) "--with-system-qemu" # use qemu from PATH
164+ ++ optional (withInternalTraditionalQemu) "--enable-qemu-traditional"
165+ ++ optional (!withInternalTraditionalQemu) "--disable-qemu-traditional"
166+
167+ ++ optional (withSeabios) "--with-system-seabios=${seabios}"
168+ ++ optional (!withInternalSeabios && !withSeabios) "--disable-seabios"
169+
170+ ++ optional (withOVMF) "--with-system-ovmf=${OVMF}"
171+ ++ optional (withInternalOVMF) "--enable-ovmf";
172+
173+ patches =
174+ [ ./0001-libxl-Spice-image-compression-setting-support-for-up.patch
175+ ./0002-libxl-Spice-streaming-video-setting-support-for-upst.patch
176+ ./0003-Add-qxl-vga-interface-support-for-upstream-qem.patch
177+ (xsaPatch {
178+ name = "190-4.5";
179+ sha256 = "0f8pw38kkxky89ny3ic5h26v9zsjj9id89lygx896zc3w1klafqm";
180+ })
181+ (xsaPatch {
182+ name = "191-4.6";
183+ sha256 = "1wl1ndli8rflmc44pkp8cw4642gi8z7j7gipac8mmlavmn3wdqhg";
184+ })
185+ (xsaPatch {
186+ name = "192-4.5";
187+ sha256 = "0m8cv0xqvx5pdk7fcmaw2vv43xhl62plyx33xqj48y66x5z9lxpm";
188+ })
189+ (xsaPatch {
190+ name = "193-4.5";
191+ sha256 = "0k9mykhrpm4rbjkhv067f6s05lqmgnldcyb3vi8cl0ndlyh66lvr";
192+ })
193+ (xsaPatch {
194+ name = "195";
195+ sha256 = "0m0g953qnjy2knd9qnkdagpvkkgjbk3ydgajia6kzs499dyqpdl7";
196+ })
197+ (xsaPatch {
198+ name = "196-0001-x86-emul-Correct-the-IDT-entry-calculation-in-inject";
199+ sha256 = "0z53nzrjvc745y26z1qc8jlg3blxp7brawvji1hx3s74n346ssl6";
200+ })
201+ (xsaPatch {
202+ name = "196-0002-x86-svm-Fix-injection-of-software-interrupts";
203+ sha256 = "11cqvr5jn2s92wsshpilx9qnfczrd9hnyb5aim6qwmz3fq3hrrkz";
204+ })
205+ (xsaPatch {
206+ name = "198";
207+ sha256 = "0d1nndn4p520c9xa87ixnyks3mrvzcri7c702d6mm22m8ansx6d9";
208+ })
209+ (xsaPatch {
210+ name = "200-4.6";
211+ sha256 = "0k918ja83470iz5k4vqi15293zjvz2dipdhgc9sy9rrhg4mqncl7";
212+ })
213+ (xsaPatch {
214+ name = "202-4.6";
215+ sha256 = "0nnznkrvfbbc8z64dr9wvbdijd4qbpc0wz2j5vpmx6b32sm7932f";
216+ })
217+ (xsaPatch {
218+ name = "204-4.5";
219+ sha256 = "083z9pbdz3f532fnzg7n2d5wzv6rmqc0f4mvc3mnmkd0rzqw8vcp";
220+ })
221+ (xsaPatch {
222+ name = "207";
223+ sha256 = "0wdlhijmw9mdj6a82pyw1rwwiz605dwzjc392zr3fpb2jklrvibc";
224+ })
225+ ];
226+
227+ # Fix build on Glibc 2.24.
228+ NIX_CFLAGS_COMPILE = "-Wno-error=deprecated-declarations";
229+
230+ postPatch = ''
231+ # Avoid a glibc >= 2.25 deprecation warnings that get fatal via -Werror.
232+ sed 1i'#include <sys/sysmacros.h>' \
233+ -i tools/blktap2/control/tap-ctl-allocate.c \
234+ -i tools/libxl/libxl_device.c
235+ '';
236+
237+})) args
pkgs/applications/virtualization/xen/generic.nix+176−145
@@ -1,188 +1,219 @@
1−{ stdenv, fetchurl, which, zlib, pkgconfig, SDL, openssl
2−, libuuid, gettext, ncurses, dev86, iasl, pciutils, bzip2
3−, lvm2, utillinux, procps, texinfo, perl, python2Packages
4−, glib, bridge-utils, xorg, pixman, iproute, udev, bison
5−, flex, cmake, ocamlPackages, figlet, libaio, yajl
6−, checkpolicy, transfig, glusterfs, acl, fetchgit, xz, spice
7−, spice_protocol, usbredir, alsaLib, quilt
1+config:
2+{ stdenv, cmake, pkgconfig, which
3+
4+# Xen
5+, bison, bzip2, checkpolicy, dev86, figlet, flex, gettext, glib
6+, iasl, libaio, libiconv, libuuid, ncurses, openssl, perl
7+, python2Packages
8+# python2Packages.python
9+, xz, yajl, zlib
10+
11+# Xen Optional
12+, ocamlPackages
13+
14+# Scripts
815, coreutils, gawk, gnused, gnugrep, diffutils, multipath-tools
9−, inetutils, iptables, openvswitch, nbd, drbd, xenConfig
10−, xenserverPatched ? false, ... }:
16+, iproute, inetutils, iptables, bridge-utils, openvswitch, nbd, drbd
17+, lvm2, utillinux, procps
18+
19+# Documentation
20+# python2Packages.markdown
21+, transfig, ghostscript, texinfo, pandoc
22+
23+, ...} @ args:
1124
1225with stdenv.lib;
1326
1427let
28+ #TODO: fix paths instead
29+ scriptEnvPath = concatMapStringsSep ":" (x: "${x}/bin") [
30+ which perl
31+ coreutils gawk gnused gnugrep diffutils utillinux multipath-tools
32+ iproute inetutils iptables bridge-utils openvswitch nbd drbd
33+ ];
34+
35+ withXenfiles = f: concatStringsSep "\n" (mapAttrsToList f config.xenfiles);
36+
37+ withTools = a: f: withXenfiles (name: x: optionalString (hasAttr a x) ''
38+ echo "processing ${name}"
39+ __do() {
40+ cd "tools/${name}"
41+ ${f name x}
42+ }
43+ ( __do )
44+ '');
45+in
1546
16− libDir = if stdenv.is64bit then "lib64" else "lib";
47+stdenv.mkDerivation (rec {
48+ inherit (config) version;
1749
18− # Sources needed to build the tools
19− # These sources are already rather old and probably do not change frequently
20− xenExtfiles = [
21− { url = http://xenbits.xensource.com/xen-extfiles/ipxe-git-9a93db3f0947484e30e753bbd61a10b17336e20e.tar.gz;
22− sha256 = "0p206zaxlhda60ci33h9gipi5gm46fvvsm6k5c0w7b6cjg0yhb33";
23− }
24− ];
50+ name = "xen-${version}";
2551
26− scriptEnvPath = stdenv.lib.concatStrings (stdenv.lib.intersperse ":" (map (x: "${x}/bin")
27− [ coreutils gawk gnused gnugrep which perl diffutils utillinux multipath-tools
28− iproute inetutils iptables bridge-utils openvswitch nbd drbd ]));
29−in
52+ dontUseCmakeConfigure = true;
3053
54+ hardeningDisable = [ "stackprotector" "fortify" "pic" ];
3155
56+ buildInputs = [
57+ cmake pkgconfig which
3258
33−stdenv.mkDerivation {
34− inherit (xenConfig) name version src;
59+ # Xen
60+ bison bzip2 checkpolicy dev86 figlet flex gettext glib iasl libaio
61+ libiconv libuuid ncurses openssl perl python2Packages.python xz yajl zlib
3562
36− dontUseCmakeConfigure = true;
63+ # oxenstored
64+ ocamlPackages.findlib ocamlPackages.ocaml
3765
38− buildInputs =
39− [ which zlib pkgconfig SDL openssl libuuid gettext ncurses
40− dev86 iasl pciutils bzip2 xz texinfo perl yajl
41− python2Packages.python python2Packages.wrapPython
42− glib bridge-utils pixman iproute udev bison xorg.libX11
43− flex ocamlPackages.ocaml ocamlPackages.findlib figlet libaio
44− checkpolicy python2Packages.markdown transfig
45− glusterfs acl cmake spice spice_protocol usbredir
46− alsaLib quilt
47− ];
66+ # Python fixes
67+ python2Packages.wrapPython
4868
49− hardeningDisable = [ "stackprotector" "fortify" "pic" ];
69+ # Documentation
70+ python2Packages.markdown transfig ghostscript texinfo pandoc
5071
51− patches = stdenv.lib.optionals ((xenserverPatched == false) && (builtins.hasAttr "xenPatches" xenConfig)) xenConfig.xenPatches;
72+ # Others
73+ ] ++ (concatMap (x: x.buildInputs or []) (attrValues config.xenfiles))
74+ ++ (config.buildInputs or []);
5275
53− postPatch = ''
54− ${stdenv.lib.optionalString ((xenserverPatched == true) && (builtins.hasAttr "xenserverPatches" xenConfig)) xenConfig.xenserverPatches}
55−
56− # Xen's tools and firmares need various git repositories that it
57− # usually checks out at time using git. We can't have that.
58− ${flip concatMapStrings xenConfig.toolsGits (x: let src = fetchgit x.git; in ''
59− cp -r ${src} tools/${src.name}-dir-remote
60− chmod -R +w tools/${src.name}-dir-remote
61− '' + stdenv.lib.optionalString (builtins.hasAttr "patches" x) ''
62− ( cd tools/${src.name}-dir-remote; ${concatStringsSep "; " (map (p: "patch -p1 < ${p}") x.patches)} )
63− '')}
64− ${flip concatMapStrings xenConfig.firmwareGits (x: let src = fetchgit x.git; in ''
65− cp -r ${src} tools/firmware/${src.name}-dir-remote
66− chmod -R +w tools/firmware/${src.name}-dir-remote
67− '' + stdenv.lib.optionalString (builtins.hasAttr "patches" x) ''
68− ( cd tools/firmware/${src.name}-dir-remote; ${concatStringsSep "; " (map (p: "patch -p1 < ${p}") x.patches)} )
69− '')}
70−
71− # Xen's stubdoms and firmwares need various sources that are usually fetched
72− # at build time using wget. We can't have that, so we prefetch Xen's ext_files.
73− mkdir xen_ext_files
74− ${flip concatMapStrings xenExtfiles (x: let src = fetchurl x; in ''
75− cp ${src} xen_ext_files/${src.name}
76− '')}
77−
78− # Avoid a glibc >= 2.25 deprecation warnings that get fatal via -Werror.
79− sed 1i'#include <sys/sysmacros.h>' \
80− -i tools/blktap2/control/tap-ctl-allocate.c \
81− -i tools/libxl/libxl_device.c
82− '';
76+ prePatch = ''
77+ ### Generic fixes
78+
79+ # Xen's stubdoms, tools and firmwares need various sources that
80+ # are usually fetched at build time using wget and git. We can't
81+ # have that, so we prefetch them in nix-expression and setup
82+ # fake wget and git for debugging purposes.
83+
84+ mkdir fake-bin
85+
86+ # Fake git: just print what it wants and die
87+ cat > fake-bin/wget << EOF
88+ #!/bin/sh -e
89+ echo ===== FAKE WGET: Not fetching \$*
90+ [ -e \$3 ]
91+ EOF
8392
84− preConfigure = ''
85− # Fake wget: copy prefetched downloads instead
86− mkdir wget
87− echo "#!/bin/sh" > wget/wget
88− echo "echo ===== Not fetching \$*, copy pre-fetched file instead" >> wget/wget
89− echo "cp \$4 \$3" >> wget/wget
90− chmod +x wget/wget
91− export PATH=$PATH:$PWD/wget
92− export EXTRA_QEMUU_CONFIGURE_ARGS="--enable-spice --enable-usb-redir --enable-linux-aio"
93+ # Fake git: just print what it wants and die
94+ cat > fake-bin/git << EOF
95+ #!/bin/sh
96+ echo ===== FAKE GIT: Not cloning \$*
97+ [ -e \$3 ]
98+ EOF
99+
100+ chmod +x fake-bin/*
101+ export PATH=$PATH:$PWD/fake-bin
102+
103+ # Remove in-tree qemu stuff in case we build from a tar-ball
104+ rm -rf tools/qemu-xen tools/qemu-xen-traditional
105+
106+ # Fix shebangs, mainly for build-scipts
107+ # We want to do this before getting prefetched stuff to speed things up
108+ # (prefetched stuff has lots of files)
109+ find . -type f | xargs sed -i 's@/usr/bin/\(python\|perl\)@/usr/bin/env \1@g'
110+ find . -type f | xargs sed -i 's@/bin/bash@/bin/sh@g'
111+
112+ # Get prefetched stuff
113+ ${withXenfiles (name: x: ''
114+ echo "${x.src} -> tools/${name}"
115+ cp -r ${x.src} tools/${name}
116+ chmod -R +w tools/${name}
117+ '')}
93118 '';
94119
95− # https://github.com/NixOS/nixpkgs/issues/13590
96− configureFlags = ["--disable-stubdom"];
120+ patches = [ ./0000-fix-ipxe-src.patch
121+ ./0000-fix-install-python.patch ]
122+ ++ (config.patches or []);
97123
98− postConfigure =
99− ''
100− substituteInPlace tools/libfsimage/common/fsimage_plugin.c \
101− --replace /usr $out
124+ postPatch = ''
125+ ### Hacks
126+
127+ # Work around a bug in our GCC wrapper: `gcc -MF foo -v' doesn't
128+ # print the GCC version number properly.
129+ substituteInPlace xen/Makefile \
130+ --replace '$(CC) $(CFLAGS) -v' '$(CC) -v'
102131
103− substituteInPlace tools/blktap2/lvm/lvm-util.c \
104− --replace /usr/sbin/vgs ${lvm2}/sbin/vgs \
105− --replace /usr/sbin/lvs ${lvm2}/sbin/lvs
132+ # Hack to get `gcc -m32' to work without having 32-bit Glibc headers.
133+ mkdir -p tools/include/gnu
134+ touch tools/include/gnu/stubs-32.h
106135
107− substituteInPlace tools/xenmon/xenmon.py \
108− --replace /usr/bin/pkill ${procps}/bin/pkill
136+ ### Fixing everything else
109137
110− substituteInPlace tools/xenstat/Makefile \
111− --replace /usr/include/curses.h ${ncurses.dev}/include/curses.h
138+ substituteInPlace tools/libfsimage/common/fsimage_plugin.c \
139+ --replace /usr $out
112140
113− substituteInPlace tools/qemu-xen-traditional/xen-hooks.mak \
114− --replace /usr/include/pci ${pciutils}/include/pci
141+ substituteInPlace tools/blktap2/lvm/lvm-util.c \
142+ --replace /usr/sbin/vgs ${lvm2}/bin/vgs \
143+ --replace /usr/sbin/lvs ${lvm2}/bin/lvs
115144
116− substituteInPlace tools/qemu-xen-traditional-dir-remote/xen-hooks.mak \
117− --replace /usr/include/pci ${pciutils}/include/pci
145+ substituteInPlace tools/misc/xenpvnetboot \
146+ --replace /usr/sbin/mount ${utillinux}/bin/mount \
147+ --replace /usr/sbin/umount ${utillinux}/bin/umount
118148
119− substituteInPlace tools/hotplug/Linux/xen-backend.rules \
120− --replace /etc/xen/scripts $out/etc/xen/scripts
149+ substituteInPlace tools/xenmon/xenmon.py \
150+ --replace /usr/bin/pkill ${procps}/bin/pkill
121151
122− # blktap is not provided by xen, but by xapi
123− sed -i '/blktap/d' tools/hotplug/Linux/xen-backend.rules
152+ substituteInPlace tools/xenstat/Makefile \
153+ --replace /usr/include/curses.h ${ncurses.dev}/include/curses.h
124154
125− # Work around a bug in our GCC wrapper: `gcc -MF foo -v' doesn't
126− # print the GCC version number properly.
127− substituteInPlace xen/Makefile \
128− --replace '$(CC) $(CFLAGS) -v' '$(CC) -v'
155+ # TODO: use this as a template and support our own if-up scripts instead?
156+ substituteInPlace tools/hotplug/Linux/xen-backend.rules.in \
157+ --replace "@XEN_SCRIPT_DIR@" $out/etc/xen/scripts
129158
130− # Allow the location of the xendomains config file to be
131− # overriden at runtime.
132− substituteInPlace tools/hotplug/Linux/init.d/xendomains \
133− --replace 'XENDOM_CONFIG=/etc/sysconfig/xendomains' "" \
134− --replace 'XENDOM_CONFIG=/etc/default/xendomains' "" \
135− --replace /etc/xen/scripts/hotplugpath.sh $out/etc/xen/scripts/hotplugpath.sh \
136− --replace /bin/ls ls
159+ # blktap is not provided by xen, but by xapi
160+ sed -i '/blktap/d' tools/hotplug/Linux/xen-backend.rules.in
137161
138− substituteInPlace tools/hotplug/Linux/xendomains \
139− --replace /bin/ls ls
162+ ${withTools "patches" (name: x: ''
163+ ${concatMapStringsSep "\n" (p: ''
164+ echo "# Patching with ${p}"
165+ patch -p1 < ${p}
166+ '') x.patches}
167+ '')}
140168
141− # Hack to get `gcc -m32' to work without having 32-bit Glibc headers.
142− mkdir -p tools/include/gnu
143− touch tools/include/gnu/stubs-32.h
144− '';
169+ ${withTools "postPatch" (name: x: x.postPatch)}
145170
146− # Fix build on Glibc 2.24.
147− NIX_CFLAGS_COMPILE = "-Wno-error=deprecated-declarations";
171+ ${config.postPatch or ""}
172+ '';
148173
149174 # TODO: Flask needs more testing before enabling it by default.
150175 #makeFlags = "XSM_ENABLE=y FLASK_ENABLE=y PREFIX=$(out) CONFIG_DIR=/etc XEN_EXTFILES_URL=\\$(XEN_ROOT)/xen_ext_files ";
151− makeFlags = "PREFIX=$(out) CONFIG_DIR=/etc XEN_EXTFILES_URL=\\$(XEN_ROOT)/xen_ext_files ";
176+ makeFlags = [ "PREFIX=$(out) CONFIG_DIR=/etc" "XEN_SCRIPT_DIR=/etc/xen/scripts" ]
177+ ++ (config.makeFlags or []);
152178
153179 buildFlags = "xen tools";
154180
155− postBuild =
156− ''
157− make -C docs man-pages
158−
159− (cd tools/xen-libhvm-dir-remote; make)
160− (cd tools/xen-libhvm-dir-remote/biospt; cc -Wall -g -D_LINUX -Wstrict-prototypes biospt.c -o biospt -I../libhvm -L../libhvm -lxenhvm)
161− '';
162−
163− installPhase =
164− ''
165− mkdir -p $out $out/share
166− cp -prvd dist/install/nix/store/*/* $out/
167− cp -prvd dist/install/boot $out/boot
168− cp -prvd dist/install/etc $out
169− cp -dR docs/man1 docs/man5 $out/share/man/
170− wrapPythonPrograms
171− substituteInPlace $out/etc/xen/scripts/hotplugpath.sh --replace SBINDIR=\"$out/sbin\" SBINDIR=\"$out/bin\"
172−
173− shopt -s extglob
174− for i in $out/etc/xen/scripts/!(*.sh); do
175− sed -i "2s@^@export PATH=$out/bin:${scriptEnvPath}\n@" $i
176− done
177−
178− (cd tools/xen-libhvm-dir-remote; make install)
179− cp tools/xen-libhvm-dir-remote/biospt/biospt $out/bin/.
180− '';
181+ postBuild = ''
182+ make -C docs man-pages
183+
184+ ${withTools "buildPhase" (name: x: x.buildPhase)}
185+ '';
186+
187+ installPhase = ''
188+ mkdir -p $out $out/share
189+ cp -prvd dist/install/nix/store/*/* $out/
190+ cp -prvd dist/install/boot $out/boot
191+ cp -prvd dist/install/etc $out
192+ cp -dR docs/man1 docs/man5 $out/share/man/
193+
194+ ${withTools "installPhase" (name: x: x.installPhase)}
195+
196+ # Hack
197+ substituteInPlace $out/etc/xen/scripts/hotplugpath.sh \
198+ --replace SBINDIR=\"$out/sbin\" SBINDIR=\"$out/bin\"
199+
200+ wrapPythonPrograms
201+
202+ shopt -s extglob
203+ for i in $out/etc/xen/scripts/!(*.sh); do
204+ sed -i "2s@^@export PATH=$out/bin:${scriptEnvPath}\n@" $i
205+ done
206+ '';
181207
182208 meta = {
183209 homepage = http://www.xen.org/;
184− description = "Xen hypervisor and management tools for Dom0";
210+ description = "Xen hypervisor and related components"
211+ + optionalString (args ? meta && args.meta ? description)
212+ " (${args.meta.description})";
213+ longDescription = (args.meta.longDescription or "")
214+ + "\nIncludes:\n"
215+ + withXenfiles (name: x: ''* ${name}: ${x.meta.description or "(No description)"}.'');
185216 platforms = [ "x86_64-linux" ];
186− maintainers = with stdenv.lib.maintainers; [ eelco tstrobel ];
217+ maintainers = with stdenv.lib.maintainers; [ eelco tstrobel oxij ];
187218 };
188−}
219+} // removeAttrs config [ "xenfiles" "buildInputs" "patches" "postPatch" "meta" ])
pkgs/applications/virtualization/xen/packages.nixnew file+64
@@ -0,0 +1,64 @@
1+{ callPackage
2+, stdenv, overrideCC, gcc49
3+}:
4+
5+# TODO on new Xen version: generalize this to generate [vanilla slim
6+# light] for each ./<version>.nix.
7+
8+rec {
9+
10+ xen_4_5-vanilla = callPackage ./4.5.nix {
11+ # At the very least included seabios and etherboot need gcc49,
12+ # so we have to build all of it with gcc49.
13+ stdenv = overrideCC stdenv gcc49;
14+
15+ meta = {
16+ description = "vanilla";
17+ longDescription = ''
18+ Vanilla version of Xen. Uses forks of Qemu and Seabios bundled
19+ with Xen. This gives vanilla experince, but wastes space and
20+ build time: typical NixOS setup that runs lots of VMs will
21+ build three different versions of Qemu when using this (two
22+ forks and upstream).
23+ '';
24+ };
25+ };
26+
27+ xen_4_5-slim = xen_4_5-vanilla.override {
28+ withInternalQemu = false;
29+ withInternalTraditionalQemu = true;
30+ withInternalSeabios = false;
31+ withSeabios = true;
32+
33+ meta = {
34+ description = "slim";
35+ longDescription = ''
36+ Slimmed-down version of Xen that reuses nixpkgs packages as
37+ much as possible. Different parts may get out of sync, but
38+ this builds faster and uses less space than vanilla. Use with
39+ `qemu_xen` from nixpkgs.
40+ '';
41+ };
42+ };
43+
44+ xen_4_5-light = xen_4_5-vanilla.override {
45+ withInternalQemu = false;
46+ withInternalTraditionalQemu = false;
47+ withInternalSeabios = false;
48+ withSeabios = true;
49+
50+ meta = {
51+ description = "light";
52+ longDescription = ''
53+ Slimmed-down version of Xen without `qemu-traditional` (you
54+ don't need it if you don't know what it is). Use with
55+ `qemu_xen-light` from nixpkgs.
56+ '';
57+ };
58+ };
59+
60+ xen-vanilla = xen_4_5-vanilla;
61+ xen-slim = xen_4_5-slim;
62+ xen-light = xen_4_5-light;
63+
64+}
pkgs/top-level/all-packages.nix+11−3
@@ -11912,6 +11912,12 @@ with pkgs;
1191211912 watch = callPackage ../os-specific/linux/procps/watch.nix { };
1191311913
1191411914 qemu_kvm = lowPrio (qemu.override { x86Only = true; });
11915+
11916+ # See `xenPackages` source for explanations.
11917+ # Building with `xen` instead of `xen-slim` is possible, but makes no sense.
11918+ qemu_xen = lowPrio (qemu.override { x86Only = true; xenSupport = true; xen = xen-slim; });
11919+ qemu_xen-light = lowPrio (qemu.override { x86Only = true; xenSupport = true; xen = xen-light; });
11920+
1191511921 qemu_test = lowPrio (qemu.override { x86Only = true; nixosTestRunner = true; });
1191611922
1191711923 firmwareLinuxNonfree = callPackage ../os-specific/linux/firmware/firmware-linux-nonfree { };
@@ -16029,9 +16035,11 @@ with pkgs;
1602916035
1603016036 xdotool = callPackage ../tools/X11/xdotool { };
1603116037
16032− xen_4_5 = callPackage ../applications/virtualization/xen/4.5.nix { stdenv = overrideCC stdenv gcc49; };
16033− xen_xenServer = callPackage ../applications/virtualization/xen/4.5.nix { xenserverPatched = true; stdenv = overrideCC stdenv gcc49; };
16034− xen = xen_4_5;
16038+ xenPackages = recurseIntoAttrs (callPackage ../applications/virtualization/xen/packages.nix {});
16039+
16040+ xen = xenPackages.xen_4_5-vanilla;
16041+ xen-slim = xenPackages.xen_4_5-slim;
16042+ xen-light = xenPackages.xen_4_5-light;
1603516043
1603616044 win-spice = callPackage ../applications/virtualization/driver/win-spice { };
1603716045 win-virtio = callPackage ../applications/virtualization/driver/win-virtio { };