rio: 0.0.36 -> 0.0.37
[NixPkgs.git] / pkgs / applications / editors / sublime / 2 / default.nix
blob6c9a43779f763896b247263832a50c973cbebf50
1 { fetchurl, lib, stdenv, glib, xorg, cairo, gtk2, makeDesktopItem }:
2 let
3   libPath = lib.makeLibraryPath [ glib xorg.libX11 gtk2 cairo ];
4 in
6 stdenv.mkDerivation rec {
7   pname = "sublimetext";
8   version = "2.0.2";
10   src =
11     if stdenv.hostPlatform.system == "i686-linux" then
12       fetchurl {
13         name = "sublimetext-${version}.tar.bz2";
14         urls = [
15           "http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%20${version}.tar.bz2"
16           "https://download.sublimetext.com/Sublime%20Text%20${version}.tar.bz2"
17         ];
18         sha256 = "026g5mppk28lzzzn9ibykcqkrd5msfmg0sc0z8w8jd7v3h28wcq7";
19       }
20     else
21       fetchurl {
22         name = "sublimetext-${version}.tar.bz2";
23         urls = [
24           "http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%20${version}.tar.bz2"
25           "https://download.sublimetext.com/Sublime%20Text%20${version}%20x64.tar.bz2"
26         ];
27         sha256 = "115b71nbv9mv8cz6bkjwpbdf2ywnjc1zy2d3080f6ck4sqqfvfh1";
28       };
29   buildCommand = ''
30     tar xvf ${src}
31     mkdir -p $out/bin
32     mv Sublime* $out/sublime
33     ln -s $out/sublime/sublime_text $out/bin/sublime
34     ln -s $out/sublime/sublime_text $out/bin/sublime2
36     echo ${libPath}
37     patchelf \
38       --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
39       --set-rpath ${libPath}:${stdenv.cc.cc.lib}/lib${lib.optionalString stdenv.is64bit "64"} \
40       $out/sublime/sublime_text
42     mkdir -p $out/share/icons
44     for x in $(ls $out/sublime/Icon); do
45       mkdir -p $out/share/icons/hicolor/$x/apps
46       cp -v $out/sublime/Icon/$x/* $out/share/icons/hicolor/$x/apps
47     done
49     ln -sv "${desktopItem}/share/applications" $out/share
50   '';
52   desktopItem = makeDesktopItem {
53     name = "sublime2";
54     exec = "sublime2 %F";
55     comment = meta.description;
56     desktopName = "Sublime Text";
57     genericName = "Text Editor";
58     categories = [ "TextEditor" "Development" ];
59     icon = "sublime_text";
60   };
62   meta = {
63     description = "Sophisticated text editor for code, markup and prose";
64     license = lib.licenses.unfree;
65     sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
66     platforms = [ "x86_64-linux" "i686-linux" ];
67   };