diff --git a/pkgs/applications/editors/sublime/default.nix b/pkgs/applications/editors/sublime/2/default.nix similarity index 100% rename from pkgs/applications/editors/sublime/default.nix rename to pkgs/applications/editors/sublime/2/default.nix diff --git a/pkgs/applications/editors/sublime3/default.nix b/pkgs/applications/editors/sublime/3/common.nix similarity index 82% rename from pkgs/applications/editors/sublime3/default.nix rename to pkgs/applications/editors/sublime/3/common.nix index 9c8a75320a61..7185a82a9601 100644 --- a/pkgs/applications/editors/sublime3/default.nix +++ b/pkgs/applications/editors/sublime/3/common.nix @@ -1,33 +1,39 @@ +{buildVersion, x32sha256, x64sha256}: + { fetchurl, stdenv, glib, xorg, cairo, gtk2, pango, makeWrapper, openssl, bzip2, pkexecPath ? "/run/wrappers/bin/pkexec", libredirect, - gksuSupport ? false, gksu, unzip, zip, bash }: + gksuSupport ? false, gksu, unzip, zip, bash}: assert stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux"; assert gksuSupport -> gksu != null; let - build = "3143"; + libPath = stdenv.lib.makeLibraryPath [glib xorg.libX11 gtk2 cairo pango]; redirects = [ "/usr/bin/pkexec=${pkexecPath}" ] ++ stdenv.lib.optional gksuSupport "/usr/bin/gksudo=${gksu}/bin/gksudo"; in let + archSha256 = + if stdenv.system == "i686-linux" then + x32sha256 + else + x64sha256; + + arch = + if stdenv.system == "i686-linux" then + "x32" + else + "x64"; + # package with just the binaries sublime = stdenv.mkDerivation { - name = "sublimetext3-${build}-bin"; - + name = "sublimetext3-${buildVersion}-bin"; src = - if stdenv.system == "i686-linux" then - fetchurl { - name = "sublimetext-${build}.tar.bz2"; - url = "https://download.sublimetext.com/sublime_text_3_build_${build}_x32.tar.bz2"; - sha256 = "0dgpx4wij2m77f478p746qadavab172166bghxmj7fb61nvw9v5i"; - } - else - fetchurl { - name = "sublimetext-${build}.tar.bz2"; - url = "https://download.sublimetext.com/sublime_text_3_build_${build}_x64.tar.bz2"; - sha256 = "06b554d2cvpxc976rvh89ix3kqc7klnngvk070xrs8wbyb221qcw"; - }; + fetchurl { + name = "sublimetext-${buildVersion}.tar.bz2"; + url = "https://download.sublimetext.com/sublime_text_3_build_${buildVersion}_${arch}.tar.bz2"; + sha256 = archSha256; + }; dontStrip = true; dontPatchELF = true; @@ -80,8 +86,8 @@ in let wrapProgram $out/plugin_host --prefix LD_PRELOAD : ${stdenv.cc.cc.lib}/lib${stdenv.lib.optionalString stdenv.is64bit "64"}/libgcc_s.so.1:${openssl.out}/lib/libssl.so:${bzip2.out}/lib/libbz2.so ''; }; -in stdenv.mkDerivation { - name = "sublimetext3-${build}"; +in stdenv.mkDerivation (rec { + name = "sublimetext3-${buildVersion}"; phases = [ "installPhase" ]; @@ -110,4 +116,4 @@ in stdenv.mkDerivation { license = licenses.unfree; platforms = platforms.linux; }; -} +}) diff --git a/pkgs/applications/editors/sublime/3/packages.nix b/pkgs/applications/editors/sublime/3/packages.nix new file mode 100644 index 000000000000..84394e85c885 --- /dev/null +++ b/pkgs/applications/editors/sublime/3/packages.nix @@ -0,0 +1,18 @@ +{ callPackage }: + +let + common = opts: callPackage (import ./common.nix opts); +in + rec { + sublime3-dev = common { + buildVersion = "3161"; + x32sha256 = "0qrm2qmfsj71lr83c8zas2n3xk8hk9k4w8ygnasjhggmyjm3wy0q"; + x64sha256 = "0cgadylm68s2jly10r038q1fvmbzmpc2nvqy86vlyq9avgqbm5pc"; + } {}; + + sublime3 = common { + buildVersion = "3143"; + x32sha256 = "0dgpx4wij2m77f478p746qadavab172166bghxmj7fb61nvw9v5i"; + x64sha256 = "06b554d2cvpxc976rvh89ix3kqc7klnngvk070xrs8wbyb221qcw"; + } {}; + } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index eba05ff31a3a..73800bf0f62a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -17824,9 +17824,11 @@ with pkgs; inherit sbcl lispPackages; }; - sublime = callPackage ../applications/editors/sublime { }; + sublime3Packages = recurseIntoAttrs (callPackage ../applications/editors/sublime/3/packages.nix { }); - sublime3 = lowPrio (callPackage ../applications/editors/sublime3 { }); + sublime3 = sublime3Packages.sublime3; + + sublime3-dev = sublime3Packages.sublime3-dev; inherit (callPackages ../applications/version-management/subversion/default.nix { bdbSupport = true;