{ stdenv, fetchurl, pkgconfig, intltool, mate, gnome3, gtk2, gtk_engines,
  gtk-engine-murrine, gdk_pixbuf, librsvg }:

stdenv.mkDerivation rec {
  name = "mate-themes-${version}";
  version = "${major-ver}.${minor-ver}";
  # There is no 3.24 release.
  major-ver = if stdenv.lib.versionOlder gnome3.version "3.23" then gnome3.version else "3.22";
  minor-ver = {
    "3.20" = "22";
    "3.22" = "13";
  }."${major-ver}";

  src = fetchurl {
    url = "http://pub.mate-desktop.org/releases/themes/${major-ver}/${name}.tar.xz";
    sha256 = {
      "3.20" = "1yjj5w7zvyjyg0k21nwk438jjsnj0qklsf0z5pmmp1jff1vxyck4";
      "3.22" = "1p7w63an8qs15hkj79nppy7471glv0rm1b0himn3c4w69q8qdc9i";
    }."${major-ver}";
  };

  nativeBuildInputs = [ pkgconfig intltool ];

  buildInputs = [ mate.mate-icon-theme gtk2 gtk_engines gtk-engine-murrine
    gdk_pixbuf librsvg ];

  meta = {
    description = "A set of themes from MATE";
    homepage = http://mate-desktop.org;
    license = stdenv.lib.licenses.lgpl21;
    platforms = stdenv.lib.platforms.unix;
    maintainers = [ stdenv.lib.maintainers.romildo ];
  };
}
