anchor.diff:  , libxml2 ? null
   }:
   
  -#assert ncursesSupport      -> ncurses != null;
  +assert ncursesSupport      -> ncurses != null;
   
   assert x11Support          -> x11 != null;
   assert xdamageSupport      -> x11Support && libXdamage != null;
  
positive.code: with stdenv.lib;
  
  stdenv.mkDerivation rec {
    name = "conky-1.9.0";
  
    src = fetchurl {
      url = "mirror://sourceforge/conky/${name}.tar.bz2";
      sha256 = "0vxvjmi3cdvnp994sv5zcdyncfn0mlxa71p2wm9zpyrmy58bbwds";
    };
  
    NIX_LDFLAGS = "-lgcc_s";
  
    buildInputs = [ pkgconfig glib ]
      ++ [ ncurses ]
      #++ optional  ncursesSupport     ncurses
      ++ optional  x11Support         x11
      ++ optional  xdamageSupport     libXdamage
      ++ optional  imlib2Support      imlib2
      ++ optional  luaSupport         lua
      ++ optionals luaImlib2Support   [ toluapp imlib2 ]
      ++ optionals luaCairoSupport    [ toluapp cairo ]
  
      ++ optional  alsaSupport        alsaLib
  
      ++ optional  wirelessSupport    wirelesstools
  
      ++ optional  curlSupport        curl
      ++ optional  rssSupport         libxml2
      ++ optional  weatherXoapSupport libxml2
      ;
  
    configureFlags =
      let flag = state: flags: if state then map (x: "--enable-${x}")  flags
                                        else map (x: "--disable-${x}") flags;
       in flag mpdSupport          [ "mpd" ]
       ++ flag ibmSupport          [ "ibm" ]
  
       #++ flag ncursesSupport      [ "ncurses" ]
       ++ flag x11Support          [ "x11" "xft" "argb" "double-buffer" "own-window" ] # conky won't compile without --enable-own-window
       ++ flag xdamageSupport      [ "xdamage" ]
       ++ flag imlib2Support       [ "imlib2" ]
       ++ flag luaSupport          [ "lua" ]
       ++ flag luaImlib2Support    [ "lua-imlib2" ]
       ++ flag luaCairoSupport     [ "lua-cairo" ]
  
       ++ flag alsaSupport         [ "alsa" ]
  
       ++ flag wirelessSupport     [ "wlan" ]
  
       ++ flag curlSupport         [ "curl" ]
       ++ flag rssSupport          [ "rss" ]
       ++ flag weatherMetarSupport [ "weather-metar" ]
       ++ flag weatherXoapSupport  [ "weather-xoap" ]
       ;
  
    meta = {
      homepage = http://conky.sourceforge.net/;
      description = "Advanced, highly configurable system monitor based on torsmo";
      maintainers = [ stdenv.lib.maintainers.guibert ];
      license = stdenv.lib.licenses.gpl3Plus;
    };
  }
  
negative.code: , mpdSupport          ? true
  , ibmSupport          ? true # IBM/Lenovo notebooks
  
  # optional features with extra dependencies
  , ncursesSupport      ? true      , ncurses       ? null
  , x11Support          ? true      , x11           ? null
  , xdamageSupport      ? x11Support, libXdamage    ? null
  , imlib2Support       ? x11Support, imlib2        ? null
  
  , luaSupport          ? true      , lua           ? null
  , luaImlib2Support    ? luaSupport && imlib2Support
  , luaCairoSupport     ? luaSupport && x11Support, cairo ? null
  , toluapp ? null
  
  , wirelessSupport     ? true      , wirelesstools ? null
  
  