From 20dad1f68df281e80bd1f8653b60835c958b66cb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?=
 <viric@vicerveza.homeunix.net>
Date: Thu, 19 Mar 2009 11:03:32 +0000
Subject: [PATCH] Making wine 32bit work in x86_64, using Dolstra suggestions,
 which worked at first try.

svn path=/nixpkgs/trunk/; revision=14602
---
 pkgs/top-level/all-packages.nix | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index e5fc0f01562..680e692acc9 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -9713,11 +9713,18 @@ let
       sqlite subversion pysqlite;
   };
 
-  wine = import ../misc/emulators/wine {
-    inherit fetchurl stdenv flex bison mesa ncurses
-      libpng libjpeg alsaLib lcms xlibs freetype
-      fontconfig fontforge libxml2 libxslt openssl;
-  };
+  wine =
+    if system == "x86_64-linux" then
+      # Can't build this in 64-bit; use a 32-bit build instead.
+      (import ./all-packages.nix {system = "i686-linux";}).wine
+      # some hackery to make nix-env show this package on x86_64...
+      // {system = "x86_64-linux";}
+    else
+      import ../misc/emulators/wine {
+        inherit fetchurl stdenv flex bison mesa ncurses
+          libpng libjpeg alsaLib lcms xlibs freetype
+          fontconfig fontforge libxml2 libxslt openssl;
+      };
 
   xosd = import ../misc/xosd {
     inherit fetchurl stdenv;